<HTML><HEAD><META CONTENT="text/html; charset=UTF-8" HTTP-EQUIV="Content-Type"/><TITLE>EMMA Coverage Report</TITLE><STYLE TYPE="text/css"> TABLE,TD,TH {border-style:solid; border-color:black;} TD,TH {background:white;margin:0;line-height:100%;padding-left:0.5em;padding-right:0.5em;} TD {border-width:0 1px 0 0;} TH {border-width:1px 1px 1px 0;} TR TD.h {color:red;} TABLE {border-spacing:0; border-collapse:collapse;border-width:0 0 1px 1px;} P,H1,H2,H3,TH {font-family:verdana,arial,sans-serif;font-size:10pt;} TD {font-family:courier,monospace;font-size:10pt;} TABLE.hdft {border-spacing:0;border-collapse:collapse;border-style:none;} TABLE.hdft TH,TABLE.hdft TD {border-style:none;line-height:normal;} TABLE.hdft TH.tl,TABLE.hdft TD.tl {background:#6699CC;color:white;} TABLE.hdft TD.nv {background:#6633DD;color:white;} .nv A:link {color:white;} .nv A:visited {color:white;} .nv A:active {color:yellow;} TABLE.hdft A:link {color:white;} TABLE.hdft A:visited {color:white;} TABLE.hdft A:active {color:yellow;} .in {color:#356085;} TABLE.s TD {padding-left:0.25em;padding-right:0.25em;} TABLE.s TD.l {padding-left:0.25em;padding-right:0.25em;text-align:right;background:#F0F0F0;} TABLE.s TR.z TD {background:#FF9999;} TABLE.s TR.p TD {background:#FFFF88;} TABLE.s TR.c TD {background:#CCFFCC;} A:link {color:#0000EE;text-decoration:none;} A:visited {color:#0000EE;text-decoration:none;} A:hover {color:#0000EE;text-decoration:underline;} TABLE.cn {border-width:0 0 1px 0;} TABLE.s {border-width:1px 0 1px 1px;} TD.h {color:red;border-width:0 1px 0 0;} TD.f {border-width:0 1px 0 1px;} TD.hf {color:red;border-width:0 1px 0 1px;} TH.f {border-width:1px 1px 1px 1px;} TR.cis TD {background:#F0F0F0;} TR.cis TD {border-width:1px 1px 1px 0;} TR.cis TD.h {color:red;border-width:1px 1px 1px 0;} TR.cis TD.f {border-width:1px 1px 1px 1px;} TR.cis TD.hf {color:red;border-width:1px 1px 1px 1px;} TD.b {border-style:none;background:transparent;line-height:50%;}  TD.bt {border-width:1px 0 0 0;background:transparent;line-height:50%;} TR.o TD {background:#F0F0F0;}TABLE.it {border-style:none;}TABLE.it TD,TABLE.it TH {border-style:none;}</STYLE></HEAD><BODY><TABLE CLASS="hdft" CELLSPACING="0" WIDTH="100%"><TR><TH CLASS="tl"><A HREF="http://emma.sourceforge.net/">EMMA</A> Coverage Report (generated Tue Aug 20 12:27:29 CST 2013)</TH></TR><TR><TD CLASS="nv">[<A HREF="../coverage.html">all classes</A>][<A HREF="4.html">cn.com.mma.mobile.tracking.api</A>]</TD></TR></TABLE><H2>COVERAGE SUMMARY FOR SOURCE FILE [<SPAN CLASS="in">Countly.java</SPAN>]</H2><TABLE CELLSPACING="0" WIDTH="100%"><TR><TH>name</TH><TH>class, %</TH><TH>method, %</TH><TH>block, %</TH><TH>line, %</TH></TR><TR><TD>Countly.java</TD><TD CLASS="h">90%  (9/10)</TD><TD CLASS="h">68%  (65/96)</TD><TD CLASS="h">45%  (1058/2335)</TD><TD CLASS="h">50%  (263.7/523)</TD></TR></TABLE><H3>COVERAGE BREAKDOWN BY CLASS AND METHOD</H3><TABLE CLASS="cn" CELLSPACING="0" WIDTH="100%"><TR><TH CLASS="f">name</TH><TH>class, %</TH><TH>method, %</TH><TH>block, %</TH><TH>line, %</TH></TR><TR><TD CLASS="b"> </TD><TD CLASS="b"> </TD><TD CLASS="b"> </TD><TD CLASS="b"> </TD><TD CLASS="b"> </TD></TR><TR CLASS="cis"><TD CLASS="f">class <A HREF="#0">ConnectionQueue$MyRunable</A></TD><TD CLASS="h">0%   (0/1)</TD><TD CLASS="h">0%   (0/2)</TD><TD CLASS="h">0%   (0/331)</TD><TD CLASS="h">0%   (0/68)</TD></TR><TR><TD CLASS="f"><A HREF="#0">ConnectionQueue$MyRunable (ConnectionQueue, SharedPreferences, ConnectionQueu...</A></TD><TD> </TD><TD CLASS="h">0%   (0/1)</TD><TD CLASS="h">0%   (0/12)</TD><TD CLASS="h">0%   (0/4)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#2">run (): void</A></TD><TD> </TD><TD CLASS="h">0%   (0/1)</TD><TD CLASS="h">0%   (0/319)</TD><TD CLASS="h">0%   (0/64)</TD></TR><TR><TD CLASS="bt"> </TD><TD CLASS="bt"> </TD><TD CLASS="bt"> </TD><TD CLASS="bt"> </TD><TD CLASS="bt"> </TD></TR><TR CLASS="cis"><TD CLASS="f">class <A HREF="#3">ConnectionQueue$1</A></TD><TD>100% (1/1)</TD><TD CLASS="h">50%  (1/2)</TD><TD CLASS="h">21%  (6/29)</TD><TD CLASS="h">20%  (1/5)</TD></TR><TR><TD CLASS="f"><A HREF="#4">hanlderError (String, Long): void</A></TD><TD> </TD><TD CLASS="h">0%   (0/1)</TD><TD CLASS="h">0%   (0/23)</TD><TD CLASS="h">0%   (0/4)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#3">ConnectionQueue$1 (ConnectionQueue): void</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>100% (6/6)</TD><TD>100% (1/1)</TD></TR><TR><TD CLASS="bt"> </TD><TD CLASS="bt"> </TD><TD CLASS="bt"> </TD><TD CLASS="bt"> </TD><TD CLASS="bt"> </TD></TR><TR CLASS="cis"><TD CLASS="f">class <A HREF="#6">ConnectionQueue</A></TD><TD>100% (1/1)</TD><TD CLASS="h">50%  (10/20)</TD><TD CLASS="h">27%  (159/584)</TD><TD CLASS="h">38%  (38.1/100)</TD></TR><TR><TD CLASS="f"><A HREF="#6">access$000 (ConnectionQueue): Context</A></TD><TD> </TD><TD CLASS="h">0%   (0/1)</TD><TD CLASS="h">0%   (0/3)</TD><TD CLASS="h">0%   (0/1)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#6">access$100 (ConnectionQueue): SharedPreferences</A></TD><TD> </TD><TD CLASS="h">0%   (0/1)</TD><TD CLASS="h">0%   (0/3)</TD><TD CLASS="h">0%   (0/1)</TD></TR><TR><TD CLASS="f"><A HREF="#6">access$200 (ConnectionQueue): SharedPreferences</A></TD><TD> </TD><TD CLASS="h">0%   (0/1)</TD><TD CLASS="h">0%   (0/3)</TD><TD CLASS="h">0%   (0/1)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#a">getContext (): Context</A></TD><TD> </TD><TD CLASS="h">0%   (0/1)</TD><TD CLASS="h">0%   (0/3)</TD><TD CLASS="h">0%   (0/1)</TD></TR><TR><TD CLASS="f"><A HREF="#b">md5 (String): String</A></TD><TD> </TD><TD CLASS="h">0%   (0/1)</TD><TD CLASS="h">0%   (0/46)</TD><TD CLASS="h">0%   (0/12)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#c">nullToEmpty (String): String</A></TD><TD> </TD><TD CLASS="h">0%   (0/1)</TD><TD CLASS="h">0%   (0/11)</TD><TD CLASS="h">0%   (0/3)</TD></TR><TR><TD CLASS="f"><A HREF="#d">nullToEmpty (String, Argument, Company): String</A></TD><TD> </TD><TD CLASS="h">0%   (0/1)</TD><TD CLASS="h">0%   (0/58)</TD><TD CLASS="h">0%   (0/10)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#e">setAppKey (String): void</A></TD><TD> </TD><TD CLASS="h">0%   (0/1)</TD><TD CLASS="h">0%   (0/4)</TD><TD CLASS="h">0%   (0/2)</TD></TR><TR><TD CLASS="f"><A HREF="#f">setServerClickURL (String): void</A></TD><TD> </TD><TD CLASS="h">0%   (0/1)</TD><TD CLASS="h">0%   (0/4)</TD><TD CLASS="h">0%   (0/2)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#10">updateLocation (Context): void</A></TD><TD> </TD><TD CLASS="h">0%   (0/1)</TD><TD CLASS="h">0%   (0/5)</TD><TD CLASS="h">0%   (0/2)</TD></TR><TR><TD CLASS="f"><A HREF="#11">recordEvents (SendEvent): void</A></TD><TD> </TD><TD>100% (1/1)</TD><TD CLASS="h">13%  (37/275)</TD><TD CLASS="h">35%  (9/26)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#12">tickThread (Thread, SharedPreferences, ConnectionQueue$ErrorHanlder): void</A></TD><TD> </TD><TD>100% (1/1)</TD><TD CLASS="h">32%  (9/28)</TD><TD CLASS="h">30%  (2.4/8)</TD></TR><TR><TD CLASS="f"><A HREF="#13">stop (): void</A></TD><TD> </TD><TD>100% (1/1)</TD><TD CLASS="h">33%  (7/21)</TD><TD CLASS="h">37%  (1.8/5)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#14">clear (): void</A></TD><TD> </TD><TD>100% (1/1)</TD><TD CLASS="h">64%  (25/39)</TD><TD CLASS="h">65%  (5.8/9)</TD></TR><TR><TD CLASS="f"><A HREF="#15">ConnectionQueue (): void</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>100% (9/9)</TD><TD>100% (4/4)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#16">clearErrorList (): void</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>100% (10/10)</TD><TD>100% (3/3)</TD></TR><TR><TD CLASS="f"><A HREF="#17">setContext (Context): void</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>100% (4/4)</TD><TD>100% (2/2)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#18">setExposeUrlList (Context): void</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>100% (31/31)</TD><TD>100% (3/3)</TD></TR><TR><TD CLASS="f"><A HREF="#19">setParams (Map): void</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>100% (4/4)</TD><TD>100% (2/2)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#1a">tick (): void</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>100% (23/23)</TD><TD>100% (5/5)</TD></TR><TR><TD CLASS="bt"> </TD><TD CLASS="bt"> </TD><TD CLASS="bt"> </TD><TD CLASS="bt"> </TD><TD CLASS="bt"> </TD></TR><TR CLASS="cis"><TD CLASS="f">class <A HREF="#1b">DeviceInfo$1</A></TD><TD>100% (1/1)</TD><TD CLASS="h">20%  (1/5)</TD><TD CLASS="h">29%  (6/21)</TD><TD CLASS="h">12%  (1/8)</TD></TR><TR><TD CLASS="f"><A HREF="#1c">onLocationChanged (Location): void</A></TD><TD> </TD><TD CLASS="h">0%   (0/1)</TD><TD CLASS="h">0%   (0/12)</TD><TD CLASS="h">0%   (0/4)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#1d">onProviderDisabled (String): void</A></TD><TD> </TD><TD CLASS="h">0%   (0/1)</TD><TD CLASS="h">0%   (0/1)</TD><TD CLASS="h">0%   (0/1)</TD></TR><TR><TD CLASS="f"><A HREF="#1e">onProviderEnabled (String): void</A></TD><TD> </TD><TD CLASS="h">0%   (0/1)</TD><TD CLASS="h">0%   (0/1)</TD><TD CLASS="h">0%   (0/1)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#1f">onStatusChanged (String, int, Bundle): void</A></TD><TD> </TD><TD CLASS="h">0%   (0/1)</TD><TD CLASS="h">0%   (0/1)</TD><TD CLASS="h">0%   (0/1)</TD></TR><TR><TD CLASS="f"><A HREF="#1b">DeviceInfo$1 (Context): void</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>100% (6/6)</TD><TD>100% (1/1)</TD></TR><TR><TD CLASS="bt"> </TD><TD CLASS="bt"> </TD><TD CLASS="bt"> </TD><TD CLASS="bt"> </TD><TD CLASS="bt"> </TD></TR><TR CLASS="cis"><TD CLASS="f">class <A HREF="#21">DeviceInfo</A></TD><TD>100% (1/1)</TD><TD CLASS="h">65%  (15/23)</TD><TD CLASS="h">50%  (274/549)</TD><TD CLASS="h">51%  (67.3/132)</TD></TR><TR><TD CLASS="f"><A HREF="#21">DeviceInfo (): void</A></TD><TD> </TD><TD CLASS="h">0%   (0/1)</TD><TD CLASS="h">0%   (0/3)</TD><TD CLASS="h">0%   (0/1)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#21">access$000 (Context): void</A></TD><TD> </TD><TD CLASS="h">0%   (0/1)</TD><TD CLASS="h">0%   (0/3)</TD><TD CLASS="h">0%   (0/1)</TD></TR><TR><TD CLASS="f"><A HREF="#24">appVersion (Context): String</A></TD><TD> </TD><TD CLASS="h">0%   (0/1)</TD><TD CLASS="h">0%   (0/14)</TD><TD CLASS="h">0%   (0/5)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#25">getCarrier (Context): String</A></TD><TD> </TD><TD CLASS="h">0%   (0/1)</TD><TD CLASS="h">0%   (0/8)</TD><TD CLASS="h">0%   (0/2)</TD></TR><TR><TD CLASS="f"><A HREF="#26">getIP (Context): String</A></TD><TD> </TD><TD CLASS="h">0%   (0/1)</TD><TD CLASS="h">0%   (0/36)</TD><TD CLASS="h">0%   (0/13)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#27">getLocale (): String</A></TD><TD> </TD><TD CLASS="h">0%   (0/1)</TD><TD CLASS="h">0%   (0/15)</TD><TD CLASS="h">0%   (0/2)</TD></TR><TR><TD CLASS="f"><A HREF="#28">getModel (): String</A></TD><TD> </TD><TD CLASS="h">0%   (0/1)</TD><TD CLASS="h">0%   (0/45)</TD><TD CLASS="h">0%   (0/8)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#29">stopListenLocation (Context): void</A></TD><TD> </TD><TD CLASS="h">0%   (0/1)</TD><TD CLASS="h">0%   (0/11)</TD><TD CLASS="h">0%   (0/4)</TD></TR><TR><TD CLASS="f"><A HREF="#2a">getLocation (Context, boolean): String</A></TD><TD> </TD><TD>100% (1/1)</TD><TD CLASS="h">31%  (46/149)</TD><TD CLASS="h">50%  (15/30)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#2b">getODIN1 (Context): String</A></TD><TD> </TD><TD>100% (1/1)</TD><TD CLASS="h">38%  (9/24)</TD><TD CLASS="h">33%  (3/9)</TD></TR><TR><TD CLASS="f"><A HREF="#2c">getUDID (): String</A></TD><TD> </TD><TD>100% (1/1)</TD><TD CLASS="h">67%  (4/6)</TD><TD CLASS="h">66%  (0.7/1)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#2d">SHA1 (String): String</A></TD><TD> </TD><TD>100% (1/1)</TD><TD CLASS="h">68%  (17/25)</TD><TD CLASS="h">57%  (4/7)</TD></TR><TR><TD CLASS="f"><A HREF="#2e">getAppName (Context): String</A></TD><TD> </TD><TD>100% (1/1)</TD><TD CLASS="h">78%  (18/23)</TD><TD CLASS="h">62%  (5/8)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#2f">isWifi (Context): boolean</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>87%  (13/15)</TD><TD>93%  (1.9/2)</TD></TR><TR><TD CLASS="f"><A HREF="#30">isNetworkAvailable (Context): boolean</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>87%  (34/39)</TD><TD>81%  (9.8/12)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#31">convertToHex (byte []): String</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>100% (58/58)</TD><TD>100% (10/10)</TD></TR><TR><TD CLASS="f"><A HREF="#32">getAndroidID (Context): String</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>100% (11/11)</TD><TD>100% (4/4)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#33">getDevice (): String</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>100% (2/2)</TD><TD>100% (1/1)</TD></TR><TR><TD CLASS="f"><A HREF="#34">getImei (Context): String</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>100% (8/8)</TD><TD>100% (2/2)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#35">getMacAddress (Context): String</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>100% (15/15)</TD><TD>100% (5/5)</TD></TR><TR><TD CLASS="f"><A HREF="#36">getOSVersion (): String</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>100% (2/2)</TD><TD>100% (1/1)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#37">getPackageName (Context): String</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>100% (3/3)</TD><TD>100% (1/1)</TD></TR><TR><TD CLASS="f"><A HREF="#38">getResolution (Context): String</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>100% (34/34)</TD><TD>100% (4/4)</TD></TR><TR><TD CLASS="bt"> </TD><TD CLASS="bt"> </TD><TD CLASS="bt"> </TD><TD CLASS="bt"> </TD><TD CLASS="bt"> </TD></TR><TR CLASS="cis"><TD CLASS="f">class <A HREF="#39">SendEvent</A></TD><TD>100% (1/1)</TD><TD CLASS="h">25%  (1/4)</TD><TD CLASS="h">62%  (15/24)</TD><TD CLASS="h">62%  (5/8)</TD></TR><TR><TD CLASS="f"><A HREF="#3a">getEventName (): String</A></TD><TD> </TD><TD CLASS="h">0%   (0/1)</TD><TD CLASS="h">0%   (0/3)</TD><TD CLASS="h">0%   (0/1)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#3b">getTimestamp (): long</A></TD><TD> </TD><TD CLASS="h">0%   (0/1)</TD><TD CLASS="h">0%   (0/3)</TD><TD CLASS="h">0%   (0/1)</TD></TR><TR><TD CLASS="f"><A HREF="#3c">getUrl (): String</A></TD><TD> </TD><TD CLASS="h">0%   (0/1)</TD><TD CLASS="h">0%   (0/3)</TD><TD CLASS="h">0%   (0/1)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#39">SendEvent (): void</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>100% (15/15)</TD><TD>100% (5/5)</TD></TR><TR><TD CLASS="bt"> </TD><TD CLASS="bt"> </TD><TD CLASS="bt"> </TD><TD CLASS="bt"> </TD><TD CLASS="bt"> </TD></TR><TR CLASS="cis"><TD CLASS="f">class <A HREF="#3e">EventQueue</A></TD><TD>100% (1/1)</TD><TD>100% (4/4)</TD><TD CLASS="h">65%  (62/95)</TD><TD CLASS="h">74%  (16.4/22)</TD></TR><TR><TD CLASS="f"><A HREF="#3f">recordEvent (String, String, String): void</A></TD><TD> </TD><TD>100% (1/1)</TD><TD CLASS="h">59%  (41/69)</TD><TD CLASS="h">69%  (10.4/15)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#40">size (): int</A></TD><TD> </TD><TD>100% (1/1)</TD><TD CLASS="h">67%  (10/15)</TD><TD CLASS="h">67%  (2/3)</TD></TR><TR><TD CLASS="f"><A HREF="#3e">EventQueue (): void</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>100% (8/8)</TD><TD>100% (3/3)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#42">events (): List</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>100% (3/3)</TD><TD>100% (1/1)</TD></TR><TR><TD CLASS="bt"> </TD><TD CLASS="bt"> </TD><TD CLASS="bt"> </TD><TD CLASS="bt"> </TD><TD CLASS="bt"> </TD></TR><TR CLASS="cis"><TD CLASS="f">class <A HREF="#43">Countly</A></TD><TD>100% (1/1)</TD><TD>91%  (29/32)</TD><TD CLASS="h">75%  (511/677)</TD><TD CLASS="h">75%  (132.9/178)</TD></TR><TR><TD CLASS="f"><A HREF="#44">getMetrics (): Map</A></TD><TD> </TD><TD CLASS="h">0%   (0/1)</TD><TD CLASS="h">0%   (0/3)</TD><TD CLASS="h">0%   (0/1)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#45">getWebViewCookies (Context, String): String</A></TD><TD> </TD><TD CLASS="h">0%   (0/1)</TD><TD CLASS="h">0%   (0/11)</TD><TD CLASS="h">0%   (0/4)</TD></TR><TR><TD CLASS="f"><A HREF="#46">setQueue_ (ConnectionQueue): void</A></TD><TD> </TD><TD CLASS="h">0%   (0/1)</TD><TD CLASS="h">0%   (0/4)</TD><TD CLASS="h">0%   (0/2)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#47">getConfigFromNetWork (): String</A></TD><TD> </TD><TD>100% (1/1)</TD><TD CLASS="h">13%  (8/62)</TD><TD CLASS="h">20%  (4/20)</TD></TR><TR><TD CLASS="f"><A HREF="#48">getSDKFromNetWork (Context): SDK</A></TD><TD> </TD><TD>100% (1/1)</TD><TD CLASS="h">23%  (13/57)</TD><TD CLASS="h">33%  (4/12)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#49">setTrackLocation (boolean, Context): void</A></TD><TD> </TD><TD>100% (1/1)</TD><TD CLASS="h">71%  (15/21)</TD><TD>86%  (6/7)</TD></TR><TR><TD CLASS="f"><A HREF="#4a">fulfillTrackingInfo (Context): void</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>83%  (90/108)</TD><TD>84%  (16/19)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#4b">init (Context): void</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>84%  (84/100)</TD><TD>83%  (20/24)</TD></TR><TR><TD CLASS="f"><A HREF="#4c">getSDKFromPreferences (Context): SDK</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>85%  (35/41)</TD><TD CLASS="h">57%  (4/7)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#4d">setSdk (SDK): void</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>95%  (52/55)</TD><TD>83%  (10/12)</TD></TR><TR><TD CLASS="f"><A HREF="#4e">onTimer (): void</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>98%  (61/62)</TD><TD>93%  (14/15)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#4f">&lt;static initializer&gt;</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>100% (17/17)</TD><TD>100% (8/8)</TD></TR><TR><TD CLASS="f"><A HREF="#50">Countly (): void</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>100% (9/9)</TD><TD>100% (4/4)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#43">access$000 (Countly): void</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>100% (3/3)</TD><TD>100% (1/1)</TD></TR><TR><TD CLASS="f"><A HREF="#52">clearAll (): void</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>100% (7/7)</TD><TD>100% (3/3)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#53">clearErrorList (): void</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>100% (7/7)</TD><TD>100% (3/3)</TD></TR><TR><TD CLASS="f"><A HREF="#54">getQueue_ (): ConnectionQueue</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>100% (3/3)</TD><TD>100% (1/1)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#55">getSdk (): SDK</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>100% (3/3)</TD><TD>100% (1/1)</TD></TR><TR><TD CLASS="f"><A HREF="#56">init (Context, String): void</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>100% (7/7)</TD><TD>100% (3/3)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#57">isTrackLocation (): boolean</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>100% (3/3)</TD><TD>100% (1/1)</TD></TR><TR><TD CLASS="f"><A HREF="#58">onClick (String): void</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>100% (7/7)</TD><TD>100% (2/2)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#59">onClickWithMUDS (String, String): void</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>100% (7/7)</TD><TD>100% (2/2)</TD></TR><TR><TD CLASS="f"><A HREF="#5a">onEvent (String, String): void</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>100% (7/7)</TD><TD>100% (2/2)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#5b">onEventWithMUDS (String, String, String): void</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>100% (7/7)</TD><TD>100% (2/2)</TD></TR><TR><TD CLASS="f"><A HREF="#5c">onExpose (String): void</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>100% (7/7)</TD><TD>100% (2/2)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#5d">onExposekWithMUDS (String, String): void</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>100% (7/7)</TD><TD>100% (2/2)</TD></TR><TR><TD CLASS="f"><A HREF="#5e">setMuid (String): void</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>100% (10/10)</TD><TD>100% (3/3)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#5f">setSDKFromNetWork (Context): void</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>100% (11/11)</TD><TD>100% (3/3)</TD></TR><TR><TD CLASS="f"><A HREF="#60">sharedInstance (): Countly</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>100% (8/8)</TD><TD>100% (3/3)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#61">stopCurrentSendThread (): void</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>100% (7/7)</TD><TD>100% (3/3)</TD></TR><TR><TD CLASS="f"><A HREF="#62">stopLoopTimer (): void</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>100% (9/9)</TD><TD>100% (4/4)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#63">updateLocationParams (String): void</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>100% (7/7)</TD><TD>100% (2/2)</TD></TR><TR><TD CLASS="bt"> </TD><TD CLASS="bt"> </TD><TD CLASS="bt"> </TD><TD CLASS="bt"> </TD><TD CLASS="bt"> </TD></TR><TR CLASS="cis"><TD CLASS="f">class <A HREF="#64">Countly$1</A></TD><TD>100% (1/1)</TD><TD>100% (2/2)</TD><TD>100% (15/15)</TD><TD>100% (3/3)</TD></TR><TR><TD CLASS="f"><A HREF="#64">Countly$1 (Countly, Context): void</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>100% (9/9)</TD><TD>100% (1/1)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#66">run (): void</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>100% (6/6)</TD><TD>100% (2/2)</TD></TR><TR><TD CLASS="bt"> </TD><TD CLASS="bt"> </TD><TD CLASS="bt"> </TD><TD CLASS="bt"> </TD><TD CLASS="bt"> </TD></TR><TR CLASS="cis"><TD CLASS="f">class <A HREF="#67">Countly$2</A></TD><TD>100% (1/1)</TD><TD>100% (2/2)</TD><TD>100% (10/10)</TD><TD>100% (3/3)</TD></TR><TR><TD CLASS="f"><A HREF="#67">Countly$2 (Countly): void</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>100% (6/6)</TD><TD>100% (1/1)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#69">run (): void</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>100% (4/4)</TD><TD>100% (2/2)</TD></TR></TABLE><P></P><TABLE CLASS="s" CELLSPACING="0" WIDTH="100%"><TR><TD CLASS="l">1</TD><TD>package cn.com.mma.mobile.tracking.api;</TD></TR><TR><TD CLASS="l">2</TD><TD> </TD></TR><TR><TD CLASS="l">3</TD><TD>import android.content.Context;</TD></TR><TR><TD CLASS="l">4</TD><TD>import android.content.SharedPreferences;</TD></TR><TR><TD CLASS="l">5</TD><TD>import android.content.pm.ApplicationInfo;</TD></TR><TR><TD CLASS="l">6</TD><TD>import android.content.pm.PackageManager;</TD></TR><TR><TD CLASS="l">7</TD><TD>import android.content.pm.PackageManager.NameNotFoundException;</TD></TR><TR><TD CLASS="l">8</TD><TD>import android.location.Criteria;</TD></TR><TR><TD CLASS="l">9</TD><TD>import android.location.Location;</TD></TR><TR><TD CLASS="l">10</TD><TD>import android.location.LocationListener;</TD></TR><TR><TD CLASS="l">11</TD><TD>import android.location.LocationManager;</TD></TR><TR><TD CLASS="l">12</TD><TD>import android.net.ConnectivityManager;</TD></TR><TR><TD CLASS="l">13</TD><TD>import android.net.NetworkInfo;</TD></TR><TR><TD CLASS="l">14</TD><TD>import android.net.wifi.WifiInfo;</TD></TR><TR><TD CLASS="l">15</TD><TD>import android.net.wifi.WifiManager;</TD></TR><TR><TD CLASS="l">16</TD><TD>import android.os.Build;</TD></TR><TR><TD CLASS="l">17</TD><TD>import android.os.Bundle;</TD></TR><TR><TD CLASS="l">18</TD><TD>import android.provider.Settings;</TD></TR><TR><TD CLASS="l">19</TD><TD>import android.telephony.TelephonyManager;</TD></TR><TR><TD CLASS="l">20</TD><TD>import android.util.DisplayMetrics;</TD></TR><TR><TD CLASS="l">21</TD><TD>import android.util.Log;</TD></TR><TR><TD CLASS="l">22</TD><TD>import android.view.WindowManager;</TD></TR><TR><TD CLASS="l">23</TD><TD>import android.webkit.CookieManager;</TD></TR><TR><TD CLASS="l">24</TD><TD>import android.webkit.CookieSyncManager;</TD></TR><TR><TD CLASS="l">25</TD><TD>import cn.com.admaster.signature.Signaturer;</TD></TR><TR><TD CLASS="l">26</TD><TD>import cn.com.mma.mobile.tracking.OpenUDID_manager;</TD></TR><TR><TD CLASS="l">27</TD><TD>import cn.com.mma.mobile.tracking.domain.*;</TD></TR><TR><TD CLASS="l">28</TD><TD>import org.apache.http.HttpResponse;</TD></TR><TR><TD CLASS="l">29</TD><TD>import org.apache.http.client.CookieStore;</TD></TR><TR><TD CLASS="l">30</TD><TD>import org.apache.http.client.methods.HttpGet;</TD></TR><TR><TD CLASS="l">31</TD><TD>import org.apache.http.cookie.Cookie;</TD></TR><TR><TD CLASS="l">32</TD><TD>import org.apache.http.impl.client.BasicCookieStore;</TD></TR><TR><TD CLASS="l">33</TD><TD>import org.apache.http.impl.client.DefaultHttpClient;</TD></TR><TR><TD CLASS="l">34</TD><TD>import org.apache.http.impl.cookie.BasicClientCookie;</TD></TR><TR><TD CLASS="l">35</TD><TD>import org.apache.http.params.CoreConnectionPNames;</TD></TR><TR><TD CLASS="l">36</TD><TD>import java.io.*;</TD></TR><TR><TD CLASS="l">37</TD><TD>import java.math.BigDecimal;</TD></TR><TR><TD CLASS="l">38</TD><TD>import java.math.BigInteger;</TD></TR><TR><TD CLASS="l">39</TD><TD>import java.net.*;</TD></TR><TR><TD CLASS="l">40</TD><TD>import java.security.MessageDigest;</TD></TR><TR><TD CLASS="l"><A NAME="43">41</A></TD><TD>import java.security.NoSuchAlgorithmException;</TD></TR><TR><TD CLASS="l">42</TD><TD>import java.util.*;</TD></TR><TR><TD CLASS="l"><A NAME="4f">43</A></TD><TD> </TD></TR><TR><TD CLASS="l">44</TD><TD> </TD></TR><TR CLASS="c"><TD CLASS="l">45</TD><TD>public class Countly {</TD></TR><TR><TD CLASS="l">46</TD><TD>    public final static String TAG = &#34;cn/com/mma/mobile/tracking/api/Countly&#34;;</TD></TR><TR CLASS="c"><TD CLASS="l">47</TD><TD>    public static boolean LOG = false; //Display or not debug message</TD></TR><TR><TD CLASS="l">48</TD><TD> </TD></TR><TR CLASS="c"><TD CLASS="l">49</TD><TD>    public static boolean SENDIMMEDIATELY = false;</TD></TR><TR CLASS="c"><TD CLASS="l">50</TD><TD>    public static int TTCOUNT = 0;</TD></TR><TR CLASS="c"><TD CLASS="l">51</TD><TD>    public static int ERRORCOUNT = 0;</TD></TR><TR><TD CLASS="l">52</TD><TD> </TD></TR><TR CLASS="c"><TD CLASS="l">53</TD><TD>    private SDK sdk = null;</TD></TR><TR><TD CLASS="l">54</TD><TD>    private static Countly sharedInstance_;</TD></TR><TR><TD CLASS="l">55</TD><TD>    private Timer timer_;</TD></TR><TR><TD CLASS="l">56</TD><TD>    private String configUrl;</TD></TR><TR><TD CLASS="l">57</TD><TD>    private ConnectionQueue queue_;</TD></TR><TR><TD CLASS="l">58</TD><TD>    private EventQueue eventQueue_;</TD></TR><TR><TD CLASS="l">59</TD><TD>    private boolean isVisible_;</TD></TR><TR><TD CLASS="l">60</TD><TD>    private double unsentSessionLength_;</TD></TR><TR><TD CLASS="l">61</TD><TD>    private double lastTime_;</TD></TR><TR><TD CLASS="l">62</TD><TD>    private Map&lt;String, String&gt; params;</TD></TR><TR CLASS="c"><TD CLASS="l">63</TD><TD>    private boolean trackLocation = false;</TD></TR><TR><TD CLASS="l">64</TD><TD> </TD></TR><TR><TD CLASS="l">65</TD><TD> </TD></TR><TR><TD CLASS="l">66</TD><TD> </TD></TR><TR CLASS="c"><TD CLASS="l">67</TD><TD>    public static int OFFLINECACHE_LENGTH = 10;</TD></TR><TR CLASS="c"><TD CLASS="l">68</TD><TD>    public static int OFFLINECACHE_QUEUEEXPIRATIONSECS = 20;</TD></TR><TR CLASS="c"><TD CLASS="l">69</TD><TD>    public static int OFFLINECACHE_TIMEOUT = 10;</TD></TR><TR CLASS="c"><TD CLASS="l">70</TD><TD>    public static int UPDATE_CONFIG_INTERVAL = 60 * 60 * 24;</TD></TR><TR><TD CLASS="l">71</TD><TD> </TD></TR><TR><TD CLASS="l">72</TD><TD>    public static final String TRACKING_MAC = &#34;MAC&#34;;</TD></TR><TR><TD CLASS="l">73</TD><TD>    public static final String TRACKING_LOCATION = &#34;LBS&#34;;</TD></TR><TR><TD CLASS="l">74</TD><TD>    public static final String TRACKING_OPENUDID = &#34;OPENUDID&#34;;</TD></TR><TR><TD CLASS="l">75</TD><TD>    public static final String TRACKING_OS = &#34;OS&#34;;</TD></TR><TR><TD CLASS="l">76</TD><TD>    public static final String TRACKING_OS_VERION = &#34;OSVS&#34;;</TD></TR><TR><TD CLASS="l">77</TD><TD>    public static final String TRACKING_WIFI = &#34;WIFI&#34;;</TD></TR><TR><TD CLASS="l">78</TD><TD>    public static final String TRACKING_NAME = &#34;ANAME&#34;;</TD></TR><TR><TD CLASS="l">79</TD><TD>    public static final String TRACKING_KEY = &#34;AKEY&#34;;</TD></TR><TR><TD CLASS="l">80</TD><TD>    public static final String TRACKING_SCWH = &#34;SCWH&#34;;</TD></TR><TR><TD CLASS="l">81</TD><TD>    public static final String TRACKING_TIMESTAMP = &#34;TS&#34;;</TD></TR><TR><TD CLASS="l">82</TD><TD>    public static final String TRACKING_ANDROIDID = &#34;ANDROIDID&#34;;</TD></TR><TR><TD CLASS="l">83</TD><TD>    public static final String TRACKING_TERM = &#34;TERM&#34;;</TD></TR><TR><TD CLASS="l">84</TD><TD>    public static final String TRACKING_IMEI = &#34;IMEI&#34;;</TD></TR><TR><TD CLASS="l">85</TD><TD>    public static final String TRACKING_ODIN = &#34;ODIN&#34;;</TD></TR><TR><TD CLASS="l">86</TD><TD>    public static final String TRACKING_MUID = &#34;MUID&#34;; //cookie or user id media give</TD></TR><TR><TD CLASS="l"><A NAME="60">87</A></TD><TD>    public static final String TRACKING_MUDS= &#34;MUDS&#34;;  //use to media define info,ex:IES-ID or oder ID</TD></TR><TR><TD CLASS="l">88</TD><TD> </TD></TR><TR><TD CLASS="l">89</TD><TD> </TD></TR><TR><TD CLASS="l">90</TD><TD>    static public Countly sharedInstance() {</TD></TR><TR CLASS="c"><TD CLASS="l">91</TD><TD>        if (sharedInstance_ == null)</TD></TR><TR CLASS="c"><TD CLASS="l"><A NAME="50">92</A></TD><TD>            sharedInstance_ = new Countly();</TD></TR><TR CLASS="c"><TD CLASS="l">93</TD><TD>        return sharedInstance_;</TD></TR><TR><TD CLASS="l">94</TD><TD>    }</TD></TR><TR><TD CLASS="l">95</TD><TD> </TD></TR><TR CLASS="c"><TD CLASS="l">96</TD><TD>    private Countly() {</TD></TR><TR><TD CLASS="l">97</TD><TD> </TD></TR><TR CLASS="c"><TD CLASS="l">98</TD><TD>    }</TD></TR><TR><TD CLASS="l">99</TD><TD> </TD></TR><TR><TD CLASS="l">100</TD><TD> </TD></TR><TR><TD CLASS="l">101</TD><TD> </TD></TR><TR><TD CLASS="l">102</TD><TD> </TD></TR><TR><TD CLASS="l">103</TD><TD>    /**</TD></TR><TR><TD CLASS="l">104</TD><TD>     * stop timer when app don't want the timer run in black,.if you want to listen AD outline ,</TD></TR><TR><TD CLASS="l"><A NAME="62">105</A></TD><TD>     * don't call it to make sure it will sent as soon as possible</TD></TR><TR><TD CLASS="l">106</TD><TD>     * after stop ,only on tick will sent</TD></TR><TR><TD CLASS="l">107</TD><TD>     */</TD></TR><TR><TD CLASS="l">108</TD><TD>    public void stopLoopTimer(){</TD></TR><TR CLASS="c"><TD CLASS="l">109</TD><TD>        if(this.timer_ != null ){</TD></TR><TR CLASS="c"><TD CLASS="l">110</TD><TD>            this.timer_.cancel();</TD></TR><TR><TD CLASS="l">111</TD><TD>        }</TD></TR><TR CLASS="c"><TD CLASS="l">112</TD><TD>        SENDIMMEDIATELY = true;</TD></TR><TR CLASS="c"><TD CLASS="l">113</TD><TD>    }</TD></TR><TR><TD CLASS="l">114</TD><TD> </TD></TR><TR><TD CLASS="l">115</TD><TD> </TD></TR><TR><TD CLASS="l">116</TD><TD> </TD></TR><TR><TD CLASS="l"><A NAME="61">117</A></TD><TD>    /**</TD></TR><TR><TD CLASS="l">118</TD><TD>     * call when exit the app , shut down the thread</TD></TR><TR><TD CLASS="l">119</TD><TD>     */</TD></TR><TR><TD CLASS="l">120</TD><TD>    public void stopCurrentSendThread(){</TD></TR><TR CLASS="c"><TD CLASS="l">121</TD><TD>        if(getQueue_() != null)</TD></TR><TR CLASS="c"><TD CLASS="l">122</TD><TD>            getQueue_().stop();</TD></TR><TR CLASS="c"><TD CLASS="l">123</TD><TD>    }</TD></TR><TR><TD CLASS="l">124</TD><TD> </TD></TR><TR><TD CLASS="l"><A NAME="52">125</A></TD><TD>    /**</TD></TR><TR><TD CLASS="l">126</TD><TD>     * clean the queen,shut down the thread</TD></TR><TR><TD CLASS="l">127</TD><TD>     */</TD></TR><TR><TD CLASS="l">128</TD><TD>    public void clearAll(){</TD></TR><TR CLASS="c"><TD CLASS="l">129</TD><TD>        if(getQueue_() != null)</TD></TR><TR CLASS="c"><TD CLASS="l">130</TD><TD>            getQueue_().clear();</TD></TR><TR CLASS="c"><TD CLASS="l">131</TD><TD>    }</TD></TR><TR><TD CLASS="l">132</TD><TD> </TD></TR><TR><TD CLASS="l"><A NAME="53">133</A></TD><TD>    /**</TD></TR><TR><TD CLASS="l">134</TD><TD>     * clean the error list</TD></TR><TR><TD CLASS="l">135</TD><TD>     */</TD></TR><TR><TD CLASS="l">136</TD><TD>    public void clearErrorList(){</TD></TR><TR CLASS="c"><TD CLASS="l">137</TD><TD>        if(getQueue_() != null)</TD></TR><TR CLASS="c"><TD CLASS="l">138</TD><TD>            getQueue_().clearErrorList();</TD></TR><TR CLASS="c"><TD CLASS="l">139</TD><TD>    }</TD></TR><TR><TD CLASS="l">140</TD><TD> </TD></TR><TR><TD CLASS="l">141</TD><TD> </TD></TR><TR><TD CLASS="l"><A NAME="44">142</A></TD><TD>    /**</TD></TR><TR><TD CLASS="l">143</TD><TD>     * get the map of SKD params</TD></TR><TR><TD CLASS="l">144</TD><TD>     */</TD></TR><TR><TD CLASS="l">145</TD><TD>    public Map&lt;String, String&gt; getMetrics() {</TD></TR><TR CLASS="z"><TD CLASS="l"><A NAME="55">146</A></TD><TD>        return params;</TD></TR><TR><TD CLASS="l">147</TD><TD>    }</TD></TR><TR><TD CLASS="l">148</TD><TD> </TD></TR><TR><TD CLASS="l">149</TD><TD>    public SDK getSdk() {</TD></TR><TR CLASS="c"><TD CLASS="l">150</TD><TD>        return sdk;</TD></TR><TR><TD CLASS="l">151</TD><TD>    }</TD></TR><TR><TD CLASS="l">152</TD><TD> </TD></TR><TR><TD CLASS="l">153</TD><TD> </TD></TR><TR><TD CLASS="l">154</TD><TD> </TD></TR><TR><TD CLASS="l">155</TD><TD>    /**</TD></TR><TR><TD CLASS="l"><A NAME="5e">156</A></TD><TD>     * cookie id or user id media give</TD></TR><TR><TD CLASS="l">157</TD><TD>     * @param muid</TD></TR><TR><TD CLASS="l">158</TD><TD>     */</TD></TR><TR><TD CLASS="l">159</TD><TD>    public void setMuid(String muid) {</TD></TR><TR CLASS="c"><TD CLASS="l">160</TD><TD>        if(params != null)</TD></TR><TR CLASS="c"><TD CLASS="l">161</TD><TD>            params.put(TRACKING_MUID,muid);</TD></TR><TR CLASS="c"><TD CLASS="l"><A NAME="57">162</A></TD><TD>    }</TD></TR><TR><TD CLASS="l">163</TD><TD> </TD></TR><TR><TD CLASS="l">164</TD><TD> </TD></TR><TR><TD CLASS="l">165</TD><TD>    public boolean isTrackLocation() {</TD></TR><TR CLASS="c"><TD CLASS="l">166</TD><TD>        return trackLocation;</TD></TR><TR><TD CLASS="l">167</TD><TD>    }</TD></TR><TR><TD CLASS="l">168</TD><TD> </TD></TR><TR><TD CLASS="l">169</TD><TD> </TD></TR><TR><TD CLASS="l">170</TD><TD> </TD></TR><TR><TD CLASS="l">171</TD><TD> </TD></TR><TR><TD CLASS="l">172</TD><TD>    /**</TD></TR><TR><TD CLASS="l">173</TD><TD>     * set open LBS or not</TD></TR><TR><TD CLASS="l"><A NAME="49">174</A></TD><TD>     * @param trackLocation</TD></TR><TR><TD CLASS="l">175</TD><TD>     * @param context</TD></TR><TR><TD CLASS="l">176</TD><TD>     */</TD></TR><TR><TD CLASS="l">177</TD><TD>    public void setTrackLocation(boolean trackLocation, Context context) {</TD></TR><TR CLASS="c"><TD CLASS="l">178</TD><TD>        if (this.trackLocation == trackLocation)</TD></TR><TR CLASS="c"><TD CLASS="l">179</TD><TD>            return;</TD></TR><TR><TD CLASS="l">180</TD><TD> </TD></TR><TR CLASS="c"><TD CLASS="l">181</TD><TD>        this.trackLocation = trackLocation;</TD></TR><TR CLASS="c"><TD CLASS="l">182</TD><TD>        if (!trackLocation)</TD></TR><TR CLASS="z"><TD CLASS="l">183</TD><TD>            params.remove(TRACKING_LOCATION);</TD></TR><TR><TD CLASS="l">184</TD><TD>        else</TD></TR><TR CLASS="c"><TD CLASS="l">185</TD><TD>            DeviceInfo.getLocation(context, true);</TD></TR><TR><TD CLASS="l">186</TD><TD> </TD></TR><TR CLASS="c"><TD CLASS="l">187</TD><TD>    }</TD></TR><TR><TD CLASS="l">188</TD><TD> </TD></TR><TR><TD CLASS="l">189</TD><TD> </TD></TR><TR><TD CLASS="l">190</TD><TD>    /**</TD></TR><TR><TD CLASS="l"><A NAME="5c">191</A></TD><TD>     * expose event</TD></TR><TR><TD CLASS="l">192</TD><TD>     * @param url</TD></TR><TR><TD CLASS="l">193</TD><TD>     */</TD></TR><TR><TD CLASS="l">194</TD><TD>    public void onExpose(String url) {</TD></TR><TR CLASS="c"><TD CLASS="l">195</TD><TD>        eventQueue_.recordEvent(url, null, null);</TD></TR><TR CLASS="c"><TD CLASS="l">196</TD><TD>    }</TD></TR><TR><TD CLASS="l">197</TD><TD> </TD></TR><TR><TD CLASS="l">198</TD><TD> </TD></TR><TR><TD CLASS="l">199</TD><TD>    /**</TD></TR><TR><TD CLASS="l"><A NAME="58">200</A></TD><TD>     * click event</TD></TR><TR><TD CLASS="l">201</TD><TD>     * @param url click url</TD></TR><TR><TD CLASS="l">202</TD><TD>     */</TD></TR><TR><TD CLASS="l">203</TD><TD>    public void onClick(String url) {</TD></TR><TR CLASS="c"><TD CLASS="l">204</TD><TD>        eventQueue_.recordEvent(url, null, null);</TD></TR><TR CLASS="c"><TD CLASS="l">205</TD><TD>    }</TD></TR><TR><TD CLASS="l">206</TD><TD> </TD></TR><TR><TD CLASS="l">207</TD><TD> </TD></TR><TR><TD CLASS="l">208</TD><TD>    /**</TD></TR><TR><TD CLASS="l">209</TD><TD>     * define event</TD></TR><TR><TD CLASS="l"><A NAME="5a">210</A></TD><TD>     * @param url  listener code url</TD></TR><TR><TD CLASS="l">211</TD><TD>     * @param eventName    define event name</TD></TR><TR><TD CLASS="l">212</TD><TD>     */</TD></TR><TR><TD CLASS="l">213</TD><TD>    public void onEvent(String url, String eventName) {</TD></TR><TR CLASS="c"><TD CLASS="l">214</TD><TD>        eventQueue_.recordEvent(url, eventName, null);</TD></TR><TR CLASS="c"><TD CLASS="l">215</TD><TD>    }</TD></TR><TR><TD CLASS="l">216</TD><TD> </TD></TR><TR><TD CLASS="l">217</TD><TD>    /**</TD></TR><TR><TD CLASS="l">218</TD><TD>     * listener click event</TD></TR><TR><TD CLASS="l"><A NAME="59">219</A></TD><TD>     * @param url</TD></TR><TR><TD CLASS="l">220</TD><TD>     * @param muds  for media to define info,ex:IED-ID or order id</TD></TR><TR><TD CLASS="l">221</TD><TD>     */</TD></TR><TR><TD CLASS="l">222</TD><TD>    public void onClickWithMUDS(String url, String muds) {</TD></TR><TR CLASS="c"><TD CLASS="l">223</TD><TD>        eventQueue_.recordEvent(url, null,muds);</TD></TR><TR CLASS="c"><TD CLASS="l">224</TD><TD>    }</TD></TR><TR><TD CLASS="l">225</TD><TD> </TD></TR><TR><TD CLASS="l">226</TD><TD> </TD></TR><TR><TD CLASS="l">227</TD><TD>    /**</TD></TR><TR><TD CLASS="l">228</TD><TD>     * expose event</TD></TR><TR><TD CLASS="l"><A NAME="5d">229</A></TD><TD>     * @param url</TD></TR><TR><TD CLASS="l">230</TD><TD>     * @param muds for media to define info,ex:IED-ID or order id</TD></TR><TR><TD CLASS="l">231</TD><TD>     */</TD></TR><TR><TD CLASS="l">232</TD><TD>    public void onExposekWithMUDS(String url, String muds) {</TD></TR><TR CLASS="c"><TD CLASS="l">233</TD><TD>        eventQueue_.recordEvent(url, null, muds);</TD></TR><TR CLASS="c"><TD CLASS="l">234</TD><TD>    }</TD></TR><TR><TD CLASS="l">235</TD><TD> </TD></TR><TR><TD CLASS="l">236</TD><TD>    /**</TD></TR><TR><TD CLASS="l">237</TD><TD>     * listen define event</TD></TR><TR><TD CLASS="l">238</TD><TD>     * @param url</TD></TR><TR><TD CLASS="l"><A NAME="5b">239</A></TD><TD>     * @param eventName</TD></TR><TR><TD CLASS="l">240</TD><TD>     * @param muds  for media to define info,ex:IED-ID or order id</TD></TR><TR><TD CLASS="l">241</TD><TD>     */</TD></TR><TR><TD CLASS="l">242</TD><TD>    public void onEventWithMUDS(String url, String eventName, String muds) {</TD></TR><TR CLASS="c"><TD CLASS="l">243</TD><TD>        eventQueue_.recordEvent(url, eventName, muds);</TD></TR><TR CLASS="c"><TD CLASS="l"><A NAME="45">244</A></TD><TD>    }</TD></TR><TR><TD CLASS="l">245</TD><TD> </TD></TR><TR><TD CLASS="l">246</TD><TD> </TD></TR><TR><TD CLASS="l">247</TD><TD>    public String getWebViewCookies(Context context, String url) {</TD></TR><TR CLASS="z"><TD CLASS="l">248</TD><TD>        CookieSyncManager.createInstance(context);</TD></TR><TR CLASS="z"><TD CLASS="l">249</TD><TD>        CookieManager cookieManager = CookieManager.getInstance();</TD></TR><TR CLASS="z"><TD CLASS="l">250</TD><TD>        String sessionCookie = cookieManager.getCookie(url);</TD></TR><TR CLASS="z"><TD CLASS="l">251</TD><TD>        return sessionCookie;</TD></TR><TR><TD CLASS="l"><A NAME="63">252</A></TD><TD> </TD></TR><TR><TD CLASS="l">253</TD><TD>    }</TD></TR><TR><TD CLASS="l">254</TD><TD> </TD></TR><TR><TD CLASS="l">255</TD><TD>    public void updateLocationParams(String latestLocation) {</TD></TR><TR CLASS="c"><TD CLASS="l">256</TD><TD>        params.put(TRACKING_LOCATION, latestLocation);</TD></TR><TR CLASS="c"><TD CLASS="l">257</TD><TD>    }</TD></TR><TR><TD CLASS="l">258</TD><TD> </TD></TR><TR><TD CLASS="l">259</TD><TD> </TD></TR><TR><TD CLASS="l">260</TD><TD> </TD></TR><TR><TD CLASS="l">261</TD><TD>    /**</TD></TR><TR><TD CLASS="l">262</TD><TD>     * init sdk</TD></TR><TR><TD CLASS="l"><A NAME="56">263</A></TD><TD>     * @param context</TD></TR><TR><TD CLASS="l">264</TD><TD>     * @param configUrl  config url</TD></TR><TR><TD CLASS="l">265</TD><TD>     */</TD></TR><TR><TD CLASS="l">266</TD><TD>    public void init(Context context, String configUrl) {</TD></TR><TR CLASS="c"><TD CLASS="l">267</TD><TD>        this.configUrl = configUrl;</TD></TR><TR CLASS="c"><TD CLASS="l">268</TD><TD>        init(context);</TD></TR><TR CLASS="c"><TD CLASS="l">269</TD><TD>    }</TD></TR><TR><TD CLASS="l">270</TD><TD> </TD></TR><TR><TD CLASS="l">271</TD><TD>    /**</TD></TR><TR><TD CLASS="l"><A NAME="4b">272</A></TD><TD>     *init sdk</TD></TR><TR><TD CLASS="l">273</TD><TD>     * @param context</TD></TR><TR><TD CLASS="l">274</TD><TD>     */</TD></TR><TR><TD CLASS="l">275</TD><TD>    public void init(final Context context) {</TD></TR><TR CLASS="c"><TD CLASS="l">276</TD><TD>        queue_ = new ConnectionQueue();</TD></TR><TR CLASS="c"><TD CLASS="l">277</TD><TD>        eventQueue_ = new EventQueue();</TD></TR><TR CLASS="c"><TD CLASS="l">278</TD><TD>        timer_ = new Timer();</TD></TR><TR CLASS="c"><TD CLASS="l">279</TD><TD>        queue_.setExposeUrlList(context);</TD></TR><TR CLASS="c"><TD CLASS="l">280</TD><TD>        OpenUDID_manager.sync(context);</TD></TR><TR CLASS="c"><TD CLASS="l">281</TD><TD>        this.trackLocation = false;</TD></TR><TR CLASS="c"><TD CLASS="l">282</TD><TD>        this.params = new HashMap&lt;String, String&gt;();</TD></TR><TR CLASS="c"><TD CLASS="l">283</TD><TD>        fulfillTrackingInfo(context);</TD></TR><TR CLASS="c"><TD CLASS="l">284</TD><TD>        queue_.setContext(context);</TD></TR><TR CLASS="c"><TD CLASS="l">285</TD><TD>        queue_.setParams(params);</TD></TR><TR CLASS="c"><TD CLASS="l">286</TD><TD>        queue_.setContext(context);</TD></TR><TR><TD CLASS="l">287</TD><TD> </TD></TR><TR><TD CLASS="l">288</TD><TD>        try {</TD></TR><TR CLASS="c"><TD CLASS="l">289</TD><TD>            SDK sdkFromPreferences =  getSDKFromPreferences(context);</TD></TR><TR CLASS="c"><TD CLASS="l">290</TD><TD>            if(sdkFromPreferences != null){</TD></TR><TR CLASS="c"><TD CLASS="l">291</TD><TD>                setSdk(sdkFromPreferences);</TD></TR><TR><TD CLASS="l">292</TD><TD>            }</TD></TR><TR><TD CLASS="l"><A NAME="64">293</A></TD><TD>            else {</TD></TR><TR CLASS="z"><TD CLASS="l">294</TD><TD>                XmlReader xmlReader = new XmlReader();</TD></TR><TR CLASS="z"><TD CLASS="l">295</TD><TD>                setSdk(xmlReader.doParser(context.getAssets().open(XmlReader.XMLFILE)));</TD></TR><TR><TD CLASS="l"><A NAME="66">296</A></TD><TD>            }</TD></TR><TR CLASS="c"><TD CLASS="l">297</TD><TD>            new Thread(new Runnable() {</TD></TR><TR><TD CLASS="l">298</TD><TD>                @Override</TD></TR><TR><TD CLASS="l">299</TD><TD>                public void run() {</TD></TR><TR CLASS="c"><TD CLASS="l">300</TD><TD>                    setSDKFromNetWork(context);</TD></TR><TR CLASS="c"><TD CLASS="l">301</TD><TD>                }</TD></TR><TR><TD CLASS="l">302</TD><TD>            }).start();</TD></TR><TR CLASS="z"><TD CLASS="l"><A NAME="67">303</A></TD><TD>        } catch (IOException e) {</TD></TR><TR CLASS="z"><TD CLASS="l">304</TD><TD>            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.</TD></TR><TR CLASS="c"><TD CLASS="l">305</TD><TD>        }</TD></TR><TR><TD CLASS="l"><A NAME="69">306</A></TD><TD> </TD></TR><TR CLASS="c"><TD CLASS="l">307</TD><TD>        timer_.schedule(new TimerTask() {</TD></TR><TR><TD CLASS="l">308</TD><TD>            @Override</TD></TR><TR><TD CLASS="l">309</TD><TD>            public void run() {</TD></TR><TR CLASS="c"><TD CLASS="l">310</TD><TD>                onTimer();</TD></TR><TR CLASS="c"><TD CLASS="l">311</TD><TD>            }</TD></TR><TR><TD CLASS="l">312</TD><TD>        }, 10 * 1000, OFFLINECACHE_QUEUEEXPIRATIONSECS * 1000);</TD></TR><TR><TD CLASS="l">313</TD><TD> </TD></TR><TR CLASS="c"><TD CLASS="l">314</TD><TD>        isVisible_ = true;</TD></TR><TR CLASS="c"><TD CLASS="l">315</TD><TD>        unsentSessionLength_ = 0;</TD></TR><TR><TD CLASS="l">316</TD><TD> </TD></TR><TR><TD CLASS="l"><A NAME="5f">317</A></TD><TD> </TD></TR><TR CLASS="c"><TD CLASS="l">318</TD><TD>    }</TD></TR><TR><TD CLASS="l">319</TD><TD> </TD></TR><TR><TD CLASS="l">320</TD><TD>    public void setSDKFromNetWork(Context context){</TD></TR><TR CLASS="c"><TD CLASS="l">321</TD><TD>        if(this.configUrl != null &amp;&amp;context != null  )</TD></TR><TR CLASS="c"><TD CLASS="l"><A NAME="4d">322</A></TD><TD>            setSdk(getSDKFromNetWork(context));</TD></TR><TR CLASS="c"><TD CLASS="l">323</TD><TD>    }</TD></TR><TR><TD CLASS="l">324</TD><TD> </TD></TR><TR><TD CLASS="l">325</TD><TD>    private void setSdk(SDK sdk) {</TD></TR><TR CLASS="c"><TD CLASS="l">326</TD><TD>        if(sdk != null){</TD></TR><TR CLASS="c"><TD CLASS="l">327</TD><TD>            this.sdk = sdk;</TD></TR><TR><TD CLASS="l">328</TD><TD>            try{</TD></TR><TR CLASS="c"><TD CLASS="l">329</TD><TD>                if(sdk.offlineCache.length != null &amp;&amp; !&#34;&#34;.equals(sdk.offlineCache.length))</TD></TR><TR CLASS="c"><TD CLASS="l">330</TD><TD>                    OFFLINECACHE_LENGTH = Integer.parseInt(sdk.offlineCache.length);</TD></TR><TR CLASS="c"><TD CLASS="l">331</TD><TD>                if(sdk.offlineCache.queueExpirationSecs != null &amp;&amp; !&#34;&#34;.equals(sdk.offlineCache.queueExpirationSecs))</TD></TR><TR CLASS="c"><TD CLASS="l">332</TD><TD>                    OFFLINECACHE_QUEUEEXPIRATIONSECS = Integer.parseInt(sdk.offlineCache.queueExpirationSecs);</TD></TR><TR CLASS="c"><TD CLASS="l">333</TD><TD>                if(sdk.offlineCache.timeout != null &amp;&amp; !&#34;&#34;.equals(sdk.offlineCache.timeout))</TD></TR><TR CLASS="c"><TD CLASS="l">334</TD><TD>                    OFFLINECACHE_TIMEOUT = Integer.parseInt(sdk.offlineCache.timeout);</TD></TR><TR CLASS="z"><TD CLASS="l">335</TD><TD>            }catch (Exception e){</TD></TR><TR CLASS="z"><TD CLASS="l">336</TD><TD>                e.printStackTrace();</TD></TR><TR CLASS="c"><TD CLASS="l">337</TD><TD>            }</TD></TR><TR><TD CLASS="l">338</TD><TD>        }</TD></TR><TR><TD CLASS="l">339</TD><TD> </TD></TR><TR CLASS="c"><TD CLASS="l"><A NAME="54">340</A></TD><TD>    }</TD></TR><TR><TD CLASS="l">341</TD><TD> </TD></TR><TR><TD CLASS="l">342</TD><TD> </TD></TR><TR><TD CLASS="l">343</TD><TD>    protected ConnectionQueue getQueue_() {</TD></TR><TR CLASS="c"><TD CLASS="l"><A NAME="46">344</A></TD><TD>        return queue_;</TD></TR><TR><TD CLASS="l">345</TD><TD>    }</TD></TR><TR><TD CLASS="l">346</TD><TD> </TD></TR><TR><TD CLASS="l">347</TD><TD>    private void setQueue_(ConnectionQueue queue_) {</TD></TR><TR CLASS="z"><TD CLASS="l">348</TD><TD>        this.queue_ = queue_;</TD></TR><TR CLASS="z"><TD CLASS="l">349</TD><TD>    }</TD></TR><TR><TD CLASS="l">350</TD><TD> </TD></TR><TR><TD CLASS="l">351</TD><TD> </TD></TR><TR><TD CLASS="l"><A NAME="47">352</A></TD><TD> </TD></TR><TR><TD CLASS="l">353</TD><TD> </TD></TR><TR><TD CLASS="l">354</TD><TD> </TD></TR><TR><TD CLASS="l">355</TD><TD>    private String getConfigFromNetWork() {</TD></TR><TR CLASS="c"><TD CLASS="l">356</TD><TD>        if (configUrl == null)</TD></TR><TR CLASS="z"><TD CLASS="l">357</TD><TD>            return null;</TD></TR><TR><TD CLASS="l">358</TD><TD> </TD></TR><TR><TD CLASS="l">359</TD><TD>        try {</TD></TR><TR CLASS="z"><TD CLASS="l">360</TD><TD>            URL url = new URL(configUrl);</TD></TR><TR CLASS="z"><TD CLASS="l">361</TD><TD>            HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();</TD></TR><TR CLASS="z"><TD CLASS="l">362</TD><TD>            urlConnection.setConnectTimeout(10000);</TD></TR><TR CLASS="z"><TD CLASS="l">363</TD><TD>            urlConnection.connect();</TD></TR><TR CLASS="z"><TD CLASS="l">364</TD><TD>            InputStream inputStream = urlConnection.getInputStream();</TD></TR><TR CLASS="z"><TD CLASS="l">365</TD><TD>            BufferedReader in = new BufferedReader(new InputStreamReader(inputStream));</TD></TR><TR CLASS="z"><TD CLASS="l">366</TD><TD>            StringBuffer buffer = new StringBuffer();</TD></TR><TR CLASS="z"><TD CLASS="l">367</TD><TD>            String line = &#34;&#34;;</TD></TR><TR CLASS="z"><TD CLASS="l">368</TD><TD>            while ((line = in.readLine()) != null) {</TD></TR><TR CLASS="z"><TD CLASS="l">369</TD><TD>                buffer.append(line);</TD></TR><TR><TD CLASS="l">370</TD><TD>            }</TD></TR><TR CLASS="z"><TD CLASS="l">371</TD><TD>            inputStream.close();</TD></TR><TR CLASS="z"><TD CLASS="l">372</TD><TD>            return buffer.toString();</TD></TR><TR CLASS="z"><TD CLASS="l">373</TD><TD>        } catch (MalformedURLException e) {</TD></TR><TR CLASS="z"><TD CLASS="l">374</TD><TD>            e.printStackTrace();</TD></TR><TR CLASS="z"><TD CLASS="l">375</TD><TD>            return null;</TD></TR><TR CLASS="c"><TD CLASS="l">376</TD><TD>        } catch (IOException e) {</TD></TR><TR CLASS="c"><TD CLASS="l">377</TD><TD>            e.printStackTrace();</TD></TR><TR CLASS="c"><TD CLASS="l">378</TD><TD>            return null;</TD></TR><TR><TD CLASS="l">379</TD><TD>        }</TD></TR><TR><TD CLASS="l"><A NAME="4c">380</A></TD><TD>    }</TD></TR><TR><TD CLASS="l">381</TD><TD> </TD></TR><TR><TD CLASS="l">382</TD><TD>    private SDK getSDKFromPreferences(Context context){</TD></TR><TR><TD CLASS="l">383</TD><TD>        try {</TD></TR><TR CLASS="c"><TD CLASS="l">384</TD><TD>            XmlReader xmlReader = new XmlReader();</TD></TR><TR CLASS="c"><TD CLASS="l">385</TD><TD>            SharedPreferences sharedPreferences = context.getSharedPreferences(context.getApplicationInfo().packageName + &#34;.tracking&#34;, 0);</TD></TR><TR CLASS="c"><TD CLASS="l">386</TD><TD>            String lastConfig = sharedPreferences.getString(&#34;trackingConfig&#34;, null);</TD></TR><TR CLASS="p"><TD CLASS="l" TITLE="97% line coverage (35 out of 36 instructions)">387</TD><TD TITLE="97% line coverage (35 out of 36 instructions)">            return lastConfig != null ? xmlReader.doParser(new ByteArrayInputStream(lastConfig.getBytes())) : null;</TD></TR><TR CLASS="z"><TD CLASS="l">388</TD><TD>        }catch (Exception e){</TD></TR><TR CLASS="z"><TD CLASS="l">389</TD><TD>            e.printStackTrace();</TD></TR><TR CLASS="z"><TD CLASS="l">390</TD><TD>            return null;</TD></TR><TR><TD CLASS="l"><A NAME="48">391</A></TD><TD>        }</TD></TR><TR><TD CLASS="l">392</TD><TD>    }</TD></TR><TR><TD CLASS="l">393</TD><TD> </TD></TR><TR><TD CLASS="l">394</TD><TD>    private SDK getSDKFromNetWork(Context context) {</TD></TR><TR CLASS="c"><TD CLASS="l">395</TD><TD>        XmlReader xmlReader = new XmlReader();</TD></TR><TR><TD CLASS="l">396</TD><TD>        try {</TD></TR><TR CLASS="c"><TD CLASS="l">397</TD><TD>            String newConfig = getConfigFromNetWork();</TD></TR><TR CLASS="c"><TD CLASS="l">398</TD><TD>            if (newConfig != null) {</TD></TR><TR CLASS="z"><TD CLASS="l">399</TD><TD>                SharedPreferences sharedPreferences = context.getSharedPreferences(context.getApplicationInfo().packageName + &#34;.tracking&#34;, 0);</TD></TR><TR CLASS="z"><TD CLASS="l">400</TD><TD>                SDK sdk = xmlReader.doParser(new ByteArrayInputStream(newConfig.getBytes(&#34;UTF-8&#34;)));</TD></TR><TR CLASS="z"><TD CLASS="l">401</TD><TD>                if (sdk != null &amp;&amp; sdk.companies.size() &gt; 0) {</TD></TR><TR CLASS="z"><TD CLASS="l">402</TD><TD>                    sharedPreferences.edit().putString(&#34;trackingConfig&#34;, newConfig).commit();</TD></TR><TR CLASS="z"><TD CLASS="l">403</TD><TD>                    return sdk;</TD></TR><TR><TD CLASS="l">404</TD><TD>                }</TD></TR><TR><TD CLASS="l">405</TD><TD>            }</TD></TR><TR CLASS="c"><TD CLASS="l">406</TD><TD>            return getSDKFromPreferences(context);</TD></TR><TR CLASS="z"><TD CLASS="l">407</TD><TD>        } catch (Exception e) {</TD></TR><TR CLASS="z"><TD CLASS="l">408</TD><TD>            e.printStackTrace();</TD></TR><TR CLASS="z"><TD CLASS="l">409</TD><TD>            return null;</TD></TR><TR><TD CLASS="l">410</TD><TD>        }</TD></TR><TR><TD CLASS="l">411</TD><TD> </TD></TR><TR><TD CLASS="l">412</TD><TD>    }</TD></TR><TR><TD CLASS="l"><A NAME="4a">413</A></TD><TD> </TD></TR><TR><TD CLASS="l">414</TD><TD> </TD></TR><TR><TD CLASS="l">415</TD><TD>    private void fulfillTrackingInfo(Context context) {</TD></TR><TR><TD CLASS="l">416</TD><TD>//        params.put(&#34;local_ip&#34;,DeviceInfo.getIP(context));</TD></TR><TR CLASS="c"><TD CLASS="l">417</TD><TD>        if (trackLocation)</TD></TR><TR CLASS="z"><TD CLASS="l">418</TD><TD>            DeviceInfo.getLocation(context, true);</TD></TR><TR CLASS="c"><TD CLASS="l">419</TD><TD>        String mac = DeviceInfo.getMacAddress(context);</TD></TR><TR CLASS="c"><TD CLASS="l">420</TD><TD>        if(mac != null ){</TD></TR><TR CLASS="z"><TD CLASS="l">421</TD><TD>            mac = mac.replaceAll(&#34;:&#34;,&#34;&#34;).toLowerCase();</TD></TR><TR CLASS="z"><TD CLASS="l">422</TD><TD>            params.put(TRACKING_MAC, mac);</TD></TR><TR><TD CLASS="l">423</TD><TD>        }</TD></TR><TR CLASS="c"><TD CLASS="l">424</TD><TD>        params.put(TRACKING_OPENUDID, DeviceInfo.getUDID());</TD></TR><TR CLASS="c"><TD CLASS="l">425</TD><TD>        params.put(TRACKING_OS_VERION, DeviceInfo.getOSVersion());</TD></TR><TR CLASS="c"><TD CLASS="l">426</TD><TD>        params.put(TRACKING_TERM, DeviceInfo.getDevice());</TD></TR><TR CLASS="p"><TD CLASS="l" TITLE="98% line coverage (82 out of 84 instructions)">427</TD><TD TITLE="98% line coverage (82 out of 84 instructions)">        params.put(TRACKING_WIFI, DeviceInfo.isWifi(context) ? &#34;1&#34; : &#34;0&#34;);</TD></TR><TR CLASS="c"><TD CLASS="l">428</TD><TD>        params.put(TRACKING_NAME, DeviceInfo.getAppName(context));</TD></TR><TR CLASS="c"><TD CLASS="l">429</TD><TD>        params.put(TRACKING_KEY, DeviceInfo.getPackageName(context));</TD></TR><TR><TD CLASS="l">430</TD><TD> </TD></TR><TR CLASS="c"><TD CLASS="l">431</TD><TD>        params.put(TRACKING_OS_VERION, DeviceInfo.getOSVersion());</TD></TR><TR CLASS="c"><TD CLASS="l">432</TD><TD>        params.put(TRACKING_OS, &#34;0&#34;);</TD></TR><TR CLASS="c"><TD CLASS="l">433</TD><TD>        params.put(TRACKING_SCWH, DeviceInfo.getResolution(context));</TD></TR><TR CLASS="c"><TD CLASS="l">434</TD><TD>        params.put(TRACKING_ANDROIDID, DeviceInfo.getAndroidID(context));</TD></TR><TR CLASS="c"><TD CLASS="l">435</TD><TD>        params.put(TRACKING_IMEI, DeviceInfo.getImei(context));</TD></TR><TR CLASS="c"><TD CLASS="l">436</TD><TD>        params.put(TRACKING_ODIN, DeviceInfo.getODIN1(context));</TD></TR><TR><TD CLASS="l">437</TD><TD> </TD></TR><TR><TD CLASS="l">438</TD><TD> </TD></TR><TR CLASS="c"><TD CLASS="l"><A NAME="4e">439</A></TD><TD>    }</TD></TR><TR><TD CLASS="l">440</TD><TD> </TD></TR><TR><TD CLASS="l">441</TD><TD> </TD></TR><TR><TD CLASS="l">442</TD><TD>    private void onTimer() {</TD></TR><TR CLASS="c"><TD CLASS="l">443</TD><TD>        if (isVisible_ == false)</TD></TR><TR CLASS="z"><TD CLASS="l">444</TD><TD>            return;</TD></TR><TR><TD CLASS="l">445</TD><TD> </TD></TR><TR CLASS="c"><TD CLASS="l">446</TD><TD>        double currTime = System.currentTimeMillis() / 1000.0;</TD></TR><TR CLASS="c"><TD CLASS="l">447</TD><TD>        unsentSessionLength_ += currTime - lastTime_;</TD></TR><TR CLASS="c"><TD CLASS="l">448</TD><TD>        lastTime_ = currTime;</TD></TR><TR><TD CLASS="l">449</TD><TD> </TD></TR><TR CLASS="c"><TD CLASS="l">450</TD><TD>        int duration = (int) unsentSessionLength_;</TD></TR><TR><TD CLASS="l">451</TD><TD>//        queue_.updateSession(duration);</TD></TR><TR CLASS="c"><TD CLASS="l">452</TD><TD>        unsentSessionLength_ -= duration;</TD></TR><TR><TD CLASS="l">453</TD><TD> </TD></TR><TR CLASS="c"><TD CLASS="l">454</TD><TD>        if (eventQueue_.size() &gt; 0) {</TD></TR><TR CLASS="c"><TD CLASS="l">455</TD><TD>            List&lt;SendEvent&gt; sendEvents = eventQueue_.events();</TD></TR><TR CLASS="c"><TD CLASS="l">456</TD><TD>            for (int i = 0; i &lt; sendEvents.size(); i++) {</TD></TR><TR CLASS="c"><TD CLASS="l">457</TD><TD>                queue_.recordEvents(sendEvents.get(i));</TD></TR><TR><TD CLASS="l">458</TD><TD>            }</TD></TR><TR CLASS="c"><TD CLASS="l">459</TD><TD>            sendEvents.clear();</TD></TR><TR CLASS="c"><TD CLASS="l">460</TD><TD>        } else {</TD></TR><TR CLASS="c"><TD CLASS="l">461</TD><TD>            getQueue_().tick();</TD></TR><TR><TD CLASS="l">462</TD><TD>        }</TD></TR><TR CLASS="c"><TD CLASS="l">463</TD><TD>    }</TD></TR><TR><TD CLASS="l">464</TD><TD> </TD></TR><TR><TD CLASS="l"><A NAME="6">465</A></TD><TD> </TD></TR><TR><TD CLASS="l">466</TD><TD> </TD></TR><TR><TD CLASS="l">467</TD><TD>}</TD></TR><TR><TD CLASS="l">468</TD><TD> </TD></TR><TR CLASS="z"><TD CLASS="l"><A NAME="18">469</A></TD><TD>class ConnectionQueue {</TD></TR><TR><TD CLASS="l">470</TD><TD> </TD></TR><TR><TD CLASS="l">471</TD><TD> </TD></TR><TR><TD CLASS="l">472</TD><TD>    public void setExposeUrlList(Context context) {</TD></TR><TR CLASS="c"><TD CLASS="l">473</TD><TD>        this.exposeUrlList = context.getSharedPreferences(context.getApplicationInfo().packageName + &#34;.tracking.exposeUrlList&#34;, 0) ;</TD></TR><TR CLASS="c"><TD CLASS="l">474</TD><TD>        this.exposeUrlListForError = context.getSharedPreferences(context.getApplicationInfo().packageName + &#34;.tracking.exposeUrlListForError&#34;, 0) ;</TD></TR><TR><TD CLASS="l">475</TD><TD> </TD></TR><TR CLASS="c"><TD CLASS="l">476</TD><TD>    }</TD></TR><TR><TD CLASS="l">477</TD><TD> </TD></TR><TR><TD CLASS="l">478</TD><TD>    private SharedPreferences exposeUrlList;</TD></TR><TR><TD CLASS="l">479</TD><TD>    private SharedPreferences exposeUrlListForError;</TD></TR><TR><TD CLASS="l">480</TD><TD> </TD></TR><TR><TD CLASS="l">481</TD><TD> </TD></TR><TR><TD CLASS="l">482</TD><TD>    //    private ConcurrentLinkedQueue&lt;List&gt; queue_ = new ConcurrentLinkedQueue&lt;List&gt;();</TD></TR><TR><TD CLASS="l">483</TD><TD>    //  thread_ ,   threadForError_ 2涓猼hread 锛宼hread涓彂閫侀敊璇殑鐩戞祴浠ｇ爜锛岀Щ鍒皌hreadForError_涓�</TD></TR><TR CLASS="c"><TD CLASS="l">484</TD><TD>    private Thread thread_ = null;</TD></TR><TR CLASS="c"><TD CLASS="l">485</TD><TD>    private Thread threadForError_ = null;</TD></TR><TR><TD CLASS="l">486</TD><TD>    private String appKey_;</TD></TR><TR><TD CLASS="l">487</TD><TD>    private Context context_;</TD></TR><TR><TD CLASS="l"><A NAME="15">488</A></TD><TD>    private String serverClickURL_;</TD></TR><TR><TD CLASS="l">489</TD><TD>    private String serverExposeURL_;</TD></TR><TR><TD CLASS="l">490</TD><TD>    private Map&lt;String, String&gt; params;</TD></TR><TR><TD CLASS="l">491</TD><TD> </TD></TR><TR CLASS="c"><TD CLASS="l"><A NAME="e">492</A></TD><TD>    ConnectionQueue() {</TD></TR><TR CLASS="c"><TD CLASS="l">493</TD><TD>    }</TD></TR><TR><TD CLASS="l">494</TD><TD> </TD></TR><TR><TD CLASS="l">495</TD><TD>    public void setAppKey(String appKey) {</TD></TR><TR CLASS="z"><TD CLASS="l"><A NAME="17">496</A></TD><TD>        appKey_ = appKey;</TD></TR><TR CLASS="z"><TD CLASS="l">497</TD><TD>    }</TD></TR><TR><TD CLASS="l">498</TD><TD> </TD></TR><TR><TD CLASS="l"><A NAME="a">499</A></TD><TD>    public void setContext(Context context) {</TD></TR><TR CLASS="c"><TD CLASS="l">500</TD><TD>        context_ = context;</TD></TR><TR CLASS="c"><TD CLASS="l">501</TD><TD>    }</TD></TR><TR><TD CLASS="l">502</TD><TD>    public Context getContext(){</TD></TR><TR CLASS="z"><TD CLASS="l"><A NAME="f">503</A></TD><TD>        return this.context_;</TD></TR><TR><TD CLASS="l">504</TD><TD>    }</TD></TR><TR><TD CLASS="l">505</TD><TD> </TD></TR><TR><TD CLASS="l">506</TD><TD>    public void setServerClickURL(String serverURL) {</TD></TR><TR CLASS="z"><TD CLASS="l"><A NAME="10">507</A></TD><TD>        serverClickURL_ = serverURL;</TD></TR><TR CLASS="z"><TD CLASS="l">508</TD><TD>    }</TD></TR><TR><TD CLASS="l">509</TD><TD> </TD></TR><TR><TD CLASS="l">510</TD><TD>    public void updateLocation(Context context) {</TD></TR><TR CLASS="z"><TD CLASS="l">511</TD><TD>        DeviceInfo.getLocation(context, true);</TD></TR><TR CLASS="z"><TD CLASS="l">512</TD><TD>    }</TD></TR><TR><TD CLASS="l">513</TD><TD> </TD></TR><TR><TD CLASS="l"><A NAME="b">514</A></TD><TD> </TD></TR><TR><TD CLASS="l">515</TD><TD> </TD></TR><TR><TD CLASS="l">516</TD><TD> </TD></TR><TR><TD CLASS="l">517</TD><TD>    public static String md5(String input) {</TD></TR><TR CLASS="z"><TD CLASS="l">518</TD><TD>        String result = input;</TD></TR><TR CLASS="z"><TD CLASS="l">519</TD><TD>        if (input != null &amp;&amp; !&#34;&#34;.equals(input)) {</TD></TR><TR><TD CLASS="l">520</TD><TD>            MessageDigest md; //or &#34;SHA-1&#34;</TD></TR><TR><TD CLASS="l">521</TD><TD>            try {</TD></TR><TR CLASS="z"><TD CLASS="l">522</TD><TD>                md = MessageDigest.getInstance(&#34;MD5&#34;);</TD></TR><TR CLASS="z"><TD CLASS="l">523</TD><TD>                md.update(input.getBytes());</TD></TR><TR CLASS="z"><TD CLASS="l">524</TD><TD>                BigInteger hash = new BigInteger(1, md.digest());</TD></TR><TR CLASS="z"><TD CLASS="l">525</TD><TD>                result = hash.toString(16);</TD></TR><TR CLASS="z"><TD CLASS="l">526</TD><TD>                while (result.length() &lt; 32) {</TD></TR><TR CLASS="z"><TD CLASS="l">527</TD><TD>                    result = &#34;0&#34; + result;</TD></TR><TR><TD CLASS="l">528</TD><TD>                }</TD></TR><TR CLASS="z"><TD CLASS="l">529</TD><TD>            } catch (NoSuchAlgorithmException e) {</TD></TR><TR CLASS="z"><TD CLASS="l">530</TD><TD>                e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.</TD></TR><TR CLASS="z"><TD CLASS="l">531</TD><TD>            }</TD></TR><TR><TD CLASS="l">532</TD><TD> </TD></TR><TR><TD CLASS="l">533</TD><TD>        }</TD></TR><TR CLASS="z"><TD CLASS="l">534</TD><TD>        return result;</TD></TR><TR><TD CLASS="l">535</TD><TD>    }</TD></TR><TR><TD CLASS="l"><A NAME="d">536</A></TD><TD> </TD></TR><TR><TD CLASS="l">537</TD><TD> </TD></TR><TR><TD CLASS="l">538</TD><TD>    private String nullToEmpty(String str, Argument argument, Company company) {</TD></TR><TR><TD CLASS="l">539</TD><TD>        try {</TD></TR><TR CLASS="z"><TD CLASS="l">540</TD><TD>            if (company.sswitch.encrypt.containsKey(argument.key)) {</TD></TR><TR CLASS="z"><TD CLASS="l">541</TD><TD>                if (&#34;md5&#34;.equals(company.sswitch.encrypt.get(argument.key))) {</TD></TR><TR CLASS="z"><TD CLASS="l">542</TD><TD>                    if (&#34;MAC&#34;.equals(argument.key)) {</TD></TR><TR CLASS="z"><TD CLASS="l">543</TD><TD>                        str = str == null ? &#34;&#34; : str.replaceAll(&#34;:&#34;, &#34;&#34;);</TD></TR><TR><TD CLASS="l">544</TD><TD>                    }</TD></TR><TR CLASS="z"><TD CLASS="l">545</TD><TD>                    str = str == null ? &#34;&#34; : md5(str.toUpperCase());</TD></TR><TR><TD CLASS="l">546</TD><TD>                }</TD></TR><TR><TD CLASS="l">547</TD><TD>            }</TD></TR><TR CLASS="z"><TD CLASS="l">548</TD><TD>            if (!argument.urlEncode)</TD></TR><TR CLASS="z"><TD CLASS="l">549</TD><TD>                return str == null ? &#34;&#34; : str;</TD></TR><TR><TD CLASS="l">550</TD><TD>            else</TD></TR><TR CLASS="z"><TD CLASS="l">551</TD><TD>                return str == null ? &#34;&#34; : URLEncoder.encode(str, &#34;utf-8&#34;);</TD></TR><TR CLASS="z"><TD CLASS="l">552</TD><TD>        } catch (UnsupportedEncodingException e) {</TD></TR><TR CLASS="z"><TD CLASS="l">553</TD><TD>            return &#34;&#34;;</TD></TR><TR><TD CLASS="l">554</TD><TD>        }</TD></TR><TR><TD CLASS="l">555</TD><TD>    }</TD></TR><TR><TD CLASS="l"><A NAME="c">556</A></TD><TD> </TD></TR><TR><TD CLASS="l">557</TD><TD> </TD></TR><TR><TD CLASS="l">558</TD><TD>    private String nullToEmpty(String str) {</TD></TR><TR><TD CLASS="l">559</TD><TD>        try {</TD></TR><TR CLASS="z"><TD CLASS="l">560</TD><TD>            return str == null ? &#34;&#34; : URLEncoder.encode(str, &#34;utf-8&#34;);</TD></TR><TR CLASS="z"><TD CLASS="l">561</TD><TD>        } catch (UnsupportedEncodingException e) {</TD></TR><TR CLASS="z"><TD CLASS="l">562</TD><TD>            return &#34;&#34;;</TD></TR><TR><TD CLASS="l">563</TD><TD>        }</TD></TR><TR><TD CLASS="l"><A NAME="11">564</A></TD><TD>    }</TD></TR><TR><TD CLASS="l">565</TD><TD> </TD></TR><TR><TD CLASS="l">566</TD><TD>    public void recordEvents(SendEvent sendEvent) {</TD></TR><TR><TD CLASS="l">567</TD><TD> </TD></TR><TR CLASS="c"><TD CLASS="l">568</TD><TD>        StringBuilder data = new StringBuilder();</TD></TR><TR CLASS="c"><TD CLASS="l">569</TD><TD>        data.append(sendEvent.url);</TD></TR><TR CLASS="c"><TD CLASS="l">570</TD><TD>        if (Countly.sharedInstance().getSdk() != null) {</TD></TR><TR CLASS="c"><TD CLASS="l">571</TD><TD>            SDK sdk = Countly.sharedInstance().getSdk();</TD></TR><TR CLASS="c"><TD CLASS="l">572</TD><TD>            for (Company company : sdk.companies) {</TD></TR><TR CLASS="c"><TD CLASS="l">573</TD><TD>                if (sendEvent.url.contains(company.domain.url)) {</TD></TR><TR CLASS="z"><TD CLASS="l">574</TD><TD>                    for (Argument argument : company.config.arguments) {</TD></TR><TR CLASS="z"><TD CLASS="l">575</TD><TD>                        if(argument.isRequired){</TD></TR><TR CLASS="z"><TD CLASS="l">576</TD><TD>                            if (Countly.TRACKING_TIMESTAMP.equals(argument.key)) {</TD></TR><TR CLASS="z"><TD CLASS="l">577</TD><TD>                                data.append(company.separator + argument.value + (company.equalizer != null ? company.equalizer : &#34;&#34;) +  (company.timeStampUseSecond?new BigDecimal(sendEvent.timestamp / 1000.0).intValue():sendEvent.getTimestamp()));</TD></TR><TR CLASS="z"><TD CLASS="l">578</TD><TD>                            } else if(Countly.TRACKING_MUDS.equals(argument.key)){</TD></TR><TR CLASS="z"><TD CLASS="l">579</TD><TD>                                data.append(company.separator + argument.value + (company.equalizer != null ? company.equalizer : &#34;&#34;) + nullToEmpty(sendEvent.muds, argument, company));</TD></TR><TR><TD CLASS="l">580</TD><TD>                            }</TD></TR><TR><TD CLASS="l">581</TD><TD>//                            else if(Countly.TRACKING_LOCATION.equals(argument.key)){</TD></TR><TR><TD CLASS="l">582</TD><TD>//                                data.append(company.separator + argument.value + (company.equalizer != null ? company.equalizer : &#34;&#34;) + nullToEmpty(DeviceInfo.getLocation(getContext(), true), argument, company));</TD></TR><TR><TD CLASS="l">583</TD><TD>//                            }</TD></TR><TR><TD CLASS="l">584</TD><TD>                            else {</TD></TR><TR CLASS="z"><TD CLASS="l">585</TD><TD>                                data.append(company.separator + argument.value + (company.equalizer != null ? company.equalizer : &#34;&#34;) + nullToEmpty(params.get(argument.key), argument, company));</TD></TR><TR><TD CLASS="l">586</TD><TD>                            }</TD></TR><TR><TD CLASS="l">587</TD><TD>                        }</TD></TR><TR><TD CLASS="l">588</TD><TD> </TD></TR><TR CLASS="z"><TD CLASS="l">589</TD><TD>                    }</TD></TR><TR CLASS="z"><TD CLASS="l">590</TD><TD>                    for (Event event : company.config.events) {</TD></TR><TR CLASS="z"><TD CLASS="l">591</TD><TD>                        if (sendEvent.getEventName() != null &amp;&amp; sendEvent.getEventName().equals(event.key)) {</TD></TR><TR CLASS="z"><TD CLASS="l">592</TD><TD>                            data.append(company.separator + nullToEmpty(event.value));</TD></TR><TR><TD CLASS="l">593</TD><TD>                        }</TD></TR><TR CLASS="z"><TD CLASS="l">594</TD><TD>                    }</TD></TR><TR CLASS="z"><TD CLASS="l">595</TD><TD>                    if (company.signature!=null&amp;&amp;company.signature.publicKey!=null&amp;&amp;company.signature.paramKey!=null){</TD></TR><TR CLASS="z"><TD CLASS="l">596</TD><TD>                        data.append(company.separator+</TD></TR><TR><TD CLASS="l">597</TD><TD>                                company.signature.paramKey+</TD></TR><TR><TD CLASS="l">598</TD><TD>                                (company.equalizer != null ? company.equalizer : &#34;&#34;)+</TD></TR><TR><TD CLASS="l">599</TD><TD>                                Signaturer.getSignature(sendEvent.url,company.signature.publicKey));</TD></TR><TR><TD CLASS="l">600</TD><TD>                    }</TD></TR><TR CLASS="z"><TD CLASS="l">601</TD><TD>                    if (company.sswitch.offlineCacheExpiration != null)</TD></TR><TR CLASS="z"><TD CLASS="l">602</TD><TD>                        exposeUrlList.edit().putLong(data.toString(), Long.parseLong(company.sswitch.offlineCacheExpiration.trim()) * 1000 + sendEvent.getTimestamp()).commit();</TD></TR><TR><TD CLASS="l">603</TD><TD>                    else {</TD></TR><TR CLASS="z"><TD CLASS="l">604</TD><TD>                        exposeUrlList.edit().putLong(data.toString(),86400 * 1000 + sendEvent.getTimestamp()).commit();</TD></TR><TR><TD CLASS="l">605</TD><TD>                    }</TD></TR><TR><TD CLASS="l">606</TD><TD>                }</TD></TR><TR CLASS="c"><TD CLASS="l">607</TD><TD>            }</TD></TR><TR><TD CLASS="l">608</TD><TD> </TD></TR><TR><TD CLASS="l">609</TD><TD> </TD></TR><TR><TD CLASS="l">610</TD><TD>        }</TD></TR><TR><TD CLASS="l">611</TD><TD> </TD></TR><TR CLASS="c"><TD CLASS="l">612</TD><TD>        tick();</TD></TR><TR><TD CLASS="l"><A NAME="13">613</A></TD><TD> </TD></TR><TR CLASS="c"><TD CLASS="l">614</TD><TD>    }</TD></TR><TR><TD CLASS="l">615</TD><TD> </TD></TR><TR><TD CLASS="l">616</TD><TD>    public void stop(){</TD></TR><TR CLASS="p"><TD CLASS="l" TITLE="43% line coverage (3 out of 7 instructions)">617</TD><TD TITLE="43% line coverage (3 out of 7 instructions)">        if(this.thread_ != null &amp;&amp; this.thread_.isAlive()){</TD></TR><TR CLASS="z"><TD CLASS="l">618</TD><TD>            this.thread_.interrupt();</TD></TR><TR><TD CLASS="l">619</TD><TD>        }</TD></TR><TR CLASS="p"><TD CLASS="l" TITLE="43% line coverage (3 out of 7 instructions)">620</TD><TD TITLE="43% line coverage (3 out of 7 instructions)">        if(this.threadForError_!=null &amp;&amp; this.threadForError_.isAlive())</TD></TR><TR CLASS="z"><TD CLASS="l">621</TD><TD>            this.threadForError_.interrupt();</TD></TR><TR><TD CLASS="l"><A NAME="14">622</A></TD><TD> </TD></TR><TR CLASS="c"><TD CLASS="l">623</TD><TD>    }</TD></TR><TR><TD CLASS="l">624</TD><TD> </TD></TR><TR><TD CLASS="l">625</TD><TD>    public void clear() {</TD></TR><TR CLASS="p"><TD CLASS="l" TITLE="43% line coverage (3 out of 7 instructions)">626</TD><TD TITLE="43% line coverage (3 out of 7 instructions)">        if(this.thread_ != null &amp;&amp; this.thread_.isAlive())</TD></TR><TR CLASS="z"><TD CLASS="l">627</TD><TD>            this.thread_.interrupt();</TD></TR><TR CLASS="p"><TD CLASS="l" TITLE="43% line coverage (3 out of 7 instructions)">628</TD><TD TITLE="43% line coverage (3 out of 7 instructions)">        if(this.threadForError_!=null &amp;&amp; this.threadForError_.isAlive())</TD></TR><TR CLASS="z"><TD CLASS="l">629</TD><TD>            this.threadForError_.interrupt();</TD></TR><TR CLASS="c"><TD CLASS="l">630</TD><TD>        if(this.exposeUrlList!=null)</TD></TR><TR CLASS="c"><TD CLASS="l">631</TD><TD>            this.exposeUrlList.edit().clear().commit();</TD></TR><TR CLASS="c"><TD CLASS="l">632</TD><TD>        if(this.exposeUrlListForError!=null)</TD></TR><TR CLASS="c"><TD CLASS="l">633</TD><TD>            this.exposeUrlListForError.edit().clear().commit();</TD></TR><TR><TD CLASS="l">634</TD><TD> </TD></TR><TR CLASS="c"><TD CLASS="l"><A NAME="16">635</A></TD><TD>    }</TD></TR><TR><TD CLASS="l">636</TD><TD> </TD></TR><TR><TD CLASS="l">637</TD><TD> </TD></TR><TR><TD CLASS="l">638</TD><TD>    public void clearErrorList() {</TD></TR><TR CLASS="c"><TD CLASS="l">639</TD><TD>        if(this.exposeUrlListForError!=null)</TD></TR><TR CLASS="c"><TD CLASS="l">640</TD><TD>            this.exposeUrlListForError.edit().clear().commit();</TD></TR><TR CLASS="c"><TD CLASS="l">641</TD><TD>    }</TD></TR><TR><TD CLASS="l">642</TD><TD> </TD></TR><TR><TD CLASS="l">643</TD><TD>    interface ErrorHanlder {</TD></TR><TR><TD CLASS="l">644</TD><TD>        void hanlderError(String key, Long value);</TD></TR><TR><TD CLASS="l">645</TD><TD>    }</TD></TR><TR><TD CLASS="l">646</TD><TD> </TD></TR><TR><TD CLASS="l">647</TD><TD>    class MyRunable implements Runnable {</TD></TR><TR><TD CLASS="l"><A NAME="0">648</A></TD><TD> </TD></TR><TR><TD CLASS="l">649</TD><TD>        private SharedPreferences sp;</TD></TR><TR><TD CLASS="l">650</TD><TD>        private ErrorHanlder errorHanlder;</TD></TR><TR><TD CLASS="l">651</TD><TD> </TD></TR><TR CLASS="z"><TD CLASS="l">652</TD><TD>        MyRunable(SharedPreferences sp, ErrorHanlder errorHanlder){</TD></TR><TR CLASS="z"><TD CLASS="l">653</TD><TD>            this.sp = sp;</TD></TR><TR CLASS="z"><TD CLASS="l">654</TD><TD>            this.errorHanlder = errorHanlder;</TD></TR><TR CLASS="z"><TD CLASS="l"><A NAME="2">655</A></TD><TD>        }</TD></TR><TR><TD CLASS="l">656</TD><TD> </TD></TR><TR><TD CLASS="l">657</TD><TD>        @Override</TD></TR><TR><TD CLASS="l">658</TD><TD>        public void run() {</TD></TR><TR CLASS="z"><TD CLASS="l">659</TD><TD>            for(String key : sp.getAll().keySet()){</TD></TR><TR CLASS="z"><TD CLASS="l">660</TD><TD>                if (!DeviceInfo.isNetworkAvailable(context_))</TD></TR><TR CLASS="z"><TD CLASS="l">661</TD><TD>                    return;</TD></TR><TR CLASS="z"><TD CLASS="l">662</TD><TD>                Long expire = null;</TD></TR><TR CLASS="z"><TD CLASS="l">663</TD><TD>                DefaultHttpClient httpClient = null;</TD></TR><TR><TD CLASS="l">664</TD><TD>                try {</TD></TR><TR CLASS="z"><TD CLASS="l">665</TD><TD>                    expire = sp.getLong(key,0);</TD></TR><TR CLASS="z"><TD CLASS="l">666</TD><TD>                    String data =key;</TD></TR><TR CLASS="z"><TD CLASS="l">667</TD><TD>                    if (Countly.LOG) Log.d(Countly.TAG, &#34;##data &#34; +(errorHanlder!=null?&#34;&#34;:&#34;in ErrorList&#34;) +&#34; :&#34; + data);</TD></TR><TR CLASS="z"><TD CLASS="l">668</TD><TD>                    if (Countly.LOG) Log.d(Countly.TAG, &#34;##ListSize &#34; +(errorHanlder!=null?&#34;&#34;:&#34;of ErrorList&#34;) +&#34; :&#34; + sp.getAll().size());</TD></TR><TR><TD CLASS="l">669</TD><TD> </TD></TR><TR><TD CLASS="l">670</TD><TD> </TD></TR><TR CLASS="z"><TD CLASS="l">671</TD><TD>                    if (data == null || &#34;&#34;.equals(data))</TD></TR><TR CLASS="z"><TD CLASS="l">672</TD><TD>                        continue;</TD></TR><TR CLASS="z"><TD CLASS="l">673</TD><TD>                    if (expire &gt; System.currentTimeMillis()) {</TD></TR><TR><TD CLASS="l">674</TD><TD> </TD></TR><TR CLASS="z"><TD CLASS="l">675</TD><TD>                        if (data.contains(&#34;REPLACE_UDID&#34;)) {</TD></TR><TR CLASS="z"><TD CLASS="l">676</TD><TD>                            if (OpenUDID_manager.isInitialized() )</TD></TR><TR CLASS="z"><TD CLASS="l">677</TD><TD>                                data.replaceFirst(&#34;REPLACE_UDID&#34;, OpenUDID_manager.getOpenUDID());</TD></TR><TR><TD CLASS="l">678</TD><TD>                        }</TD></TR><TR CLASS="z"><TD CLASS="l">679</TD><TD>                        CookieSyncManager.createInstance(getContext());</TD></TR><TR CLASS="z"><TD CLASS="l">680</TD><TD>                        CookieManager cookieManager = CookieManager.getInstance();</TD></TR><TR CLASS="z"><TD CLASS="l">681</TD><TD>                        String sessionCookie = cookieManager.getCookie(data);</TD></TR><TR CLASS="z"><TD CLASS="l">682</TD><TD>                        CookieStore cookieStore = new BasicCookieStore();</TD></TR><TR><TD CLASS="l">683</TD><TD>                        String[] cookie_parts;</TD></TR><TR CLASS="z"><TD CLASS="l">684</TD><TD>                        if (sessionCookie != null &amp;&amp; sessionCookie.length() &gt; 0) {</TD></TR><TR CLASS="z"><TD CLASS="l">685</TD><TD>                            cookie_parts = sessionCookie.split(&#34;;&#34;);</TD></TR><TR CLASS="z"><TD CLASS="l">686</TD><TD>                            for (int t = 0; t &lt; cookie_parts.length; t++) {</TD></TR><TR CLASS="z"><TD CLASS="l">687</TD><TD>                                String[] cookieContent = cookie_parts[t].split(&#34;=&#34;);</TD></TR><TR CLASS="z"><TD CLASS="l">688</TD><TD>                                if (cookieContent.length == 2) {</TD></TR><TR CLASS="z"><TD CLASS="l">689</TD><TD>                                    Cookie cookie = new BasicClientCookie(cookieContent[0], cookieContent[1]);</TD></TR><TR CLASS="z"><TD CLASS="l">690</TD><TD>                                    ((BasicClientCookie) cookie).setDomain(data.replace(&#34;http://&#34;, &#34;&#34;).replaceAll(&#34;/.*&#34;, &#34;&#34;).replaceAll(&#34;:\\d*&#34;, &#34;&#34;));</TD></TR><TR CLASS="z"><TD CLASS="l">691</TD><TD>                                    cookieStore.addCookie(cookie);</TD></TR><TR><TD CLASS="l">692</TD><TD>                                }</TD></TR><TR><TD CLASS="l">693</TD><TD>                            }</TD></TR><TR><TD CLASS="l">694</TD><TD>                        }</TD></TR><TR CLASS="z"><TD CLASS="l">695</TD><TD>                        CookieSyncManager.getInstance().sync();</TD></TR><TR CLASS="z"><TD CLASS="l">696</TD><TD>                        httpClient = new DefaultHttpClient();</TD></TR><TR CLASS="z"><TD CLASS="l">697</TD><TD>                        httpClient.getParams().setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, Countly.sharedInstance().OFFLINECACHE_TIMEOUT * 1000);</TD></TR><TR CLASS="z"><TD CLASS="l">698</TD><TD>                        httpClient.getParams().setParameter(CoreConnectionPNames.SO_TIMEOUT, Countly.sharedInstance().OFFLINECACHE_TIMEOUT * 1000);</TD></TR><TR CLASS="z"><TD CLASS="l">699</TD><TD>                        httpClient.setCookieStore(cookieStore);</TD></TR><TR CLASS="z"><TD CLASS="l">700</TD><TD>                        HttpGet method = new HttpGet(new URI(data));</TD></TR><TR CLASS="z"><TD CLASS="l">701</TD><TD>                        HttpResponse response = httpClient.execute(method);</TD></TR><TR CLASS="z"><TD CLASS="l">702</TD><TD>                        InputStream input = response.getEntity().getContent();</TD></TR><TR CLASS="z"><TD CLASS="l">703</TD><TD>                        while (input.read() != -1)</TD></TR><TR CLASS="z"><TD CLASS="l">704</TD><TD>                            ;</TD></TR><TR CLASS="z"><TD CLASS="l">705</TD><TD>                        input.close();</TD></TR><TR CLASS="z"><TD CLASS="l">706</TD><TD>                        List&lt;Cookie&gt; cookies = httpClient.getCookieStore().getCookies();</TD></TR><TR CLASS="z"><TD CLASS="l">707</TD><TD>                        if (!cookies.isEmpty()) {</TD></TR><TR CLASS="z"><TD CLASS="l">708</TD><TD>                            for (Cookie cookie : cookies) {</TD></TR><TR CLASS="z"><TD CLASS="l">709</TD><TD>                                String cookieString = cookie.getName() + &#34;=&#34; + cookie.getValue() + &#34;; domain=&#34; + cookie.getDomain();</TD></TR><TR CLASS="z"><TD CLASS="l">710</TD><TD>                                cookieManager.setCookie(data, cookieString);</TD></TR><TR CLASS="z"><TD CLASS="l">711</TD><TD>                                CookieSyncManager.getInstance().sync();</TD></TR><TR CLASS="z"><TD CLASS="l">712</TD><TD>                            }</TD></TR><TR><TD CLASS="l">713</TD><TD>                        }</TD></TR><TR CLASS="z"><TD CLASS="l">714</TD><TD>                        httpClient.getConnectionManager().shutdown();</TD></TR><TR><TD CLASS="l">715</TD><TD>                    }</TD></TR><TR CLASS="z"><TD CLASS="l">716</TD><TD>                    sp.edit().remove(key).commit();</TD></TR><TR><TD CLASS="l">717</TD><TD> </TD></TR><TR CLASS="z"><TD CLASS="l">718</TD><TD>                }catch (URISyntaxException e) {</TD></TR><TR CLASS="z"><TD CLASS="l">719</TD><TD>                    e.printStackTrace();</TD></TR><TR CLASS="z"><TD CLASS="l">720</TD><TD>                    if(httpClient != null &amp;&amp; httpClient.getConnectionManager() !=null)</TD></TR><TR CLASS="z"><TD CLASS="l">721</TD><TD>                        httpClient.getConnectionManager().shutdown();</TD></TR><TR CLASS="z"><TD CLASS="l">722</TD><TD>                    if(errorHanlder!=null)</TD></TR><TR CLASS="z"><TD CLASS="l">723</TD><TD>                        errorHanlder.hanlderError(key, expire);</TD></TR><TR CLASS="z"><TD CLASS="l">724</TD><TD>                    continue;</TD></TR><TR><TD CLASS="l">725</TD><TD>                }</TD></TR><TR CLASS="z"><TD CLASS="l">726</TD><TD>                catch (Exception e) {</TD></TR><TR CLASS="z"><TD CLASS="l">727</TD><TD>                    e.printStackTrace();</TD></TR><TR CLASS="z"><TD CLASS="l">728</TD><TD>                    if(httpClient != null &amp;&amp; httpClient.getConnectionManager() !=null)</TD></TR><TR CLASS="z"><TD CLASS="l">729</TD><TD>                        httpClient.getConnectionManager().shutdown();</TD></TR><TR CLASS="z"><TD CLASS="l">730</TD><TD>                    if(errorHanlder!=null)</TD></TR><TR CLASS="z"><TD CLASS="l">731</TD><TD>                        errorHanlder.hanlderError(key, expire);</TD></TR><TR CLASS="z"><TD CLASS="l">732</TD><TD>                    continue;</TD></TR><TR><TD CLASS="l">733</TD><TD> </TD></TR><TR CLASS="z"><TD CLASS="l">734</TD><TD>                }</TD></TR><TR CLASS="z"><TD CLASS="l">735</TD><TD>            }</TD></TR><TR CLASS="z"><TD CLASS="l">736</TD><TD>        }</TD></TR><TR><TD CLASS="l">737</TD><TD> </TD></TR><TR><TD CLASS="l">738</TD><TD>    }</TD></TR><TR><TD CLASS="l">739</TD><TD> </TD></TR><TR><TD CLASS="l">740</TD><TD> </TD></TR><TR><TD CLASS="l"><A NAME="1a">741</A></TD><TD>    //start two thread to sent new listene code,</TD></TR><TR><TD CLASS="l">742</TD><TD>    //save by SharePerferences exposeUrlList,if error on post ,move it to exposeUrlListForError</TD></TR><TR><TD CLASS="l"><A NAME="3">743</A></TD><TD>    //threadForError will read error code form exposeUrlListForError and send</TD></TR><TR><TD CLASS="l">744</TD><TD>    public void tick() {</TD></TR><TR CLASS="c"><TD CLASS="l">745</TD><TD>        if (!DeviceInfo.isNetworkAvailable(context_))</TD></TR><TR CLASS="c"><TD CLASS="l">746</TD><TD>            return;</TD></TR><TR CLASS="c"><TD CLASS="l"><A NAME="4">747</A></TD><TD>        tickThread(thread_, exposeUrlList, new ErrorHanlder() {</TD></TR><TR><TD CLASS="l">748</TD><TD> </TD></TR><TR><TD CLASS="l">749</TD><TD>            @Override</TD></TR><TR><TD CLASS="l">750</TD><TD>            public void hanlderError(String key, Long value) {</TD></TR><TR CLASS="z"><TD CLASS="l">751</TD><TD>                if(exposeUrlListForError != null){</TD></TR><TR CLASS="z"><TD CLASS="l">752</TD><TD>                    exposeUrlList.edit().remove(key).commit();</TD></TR><TR CLASS="z"><TD CLASS="l">753</TD><TD>                    exposeUrlListForError.edit().putLong(key,value).commit();</TD></TR><TR><TD CLASS="l">754</TD><TD> </TD></TR><TR><TD CLASS="l">755</TD><TD>                }</TD></TR><TR CLASS="z"><TD CLASS="l">756</TD><TD>            }</TD></TR><TR><TD CLASS="l">757</TD><TD>        });</TD></TR><TR CLASS="c"><TD CLASS="l"><A NAME="12">758</A></TD><TD>        tickThread(threadForError_,exposeUrlListForError, null);</TD></TR><TR CLASS="c"><TD CLASS="l">759</TD><TD>    }</TD></TR><TR><TD CLASS="l">760</TD><TD> </TD></TR><TR><TD CLASS="l">761</TD><TD>    private void tickThread(Thread thread, SharedPreferences sp, ErrorHanlder errorHanlder){</TD></TR><TR CLASS="p"><TD CLASS="l" TITLE="40% line coverage (2 out of 5 instructions)">762</TD><TD TITLE="40% line coverage (2 out of 5 instructions)">        if (thread != null &amp;&amp; thread.isAlive()) {</TD></TR><TR CLASS="z"><TD CLASS="l">763</TD><TD>            return;</TD></TR><TR><TD CLASS="l">764</TD><TD>        }</TD></TR><TR CLASS="c"><TD CLASS="l">765</TD><TD>        if(sp == null || sp.getAll().isEmpty())</TD></TR><TR CLASS="c"><TD CLASS="l">766</TD><TD>            return;</TD></TR><TR CLASS="z"><TD CLASS="l">767</TD><TD>        if(thread == null)</TD></TR><TR CLASS="z"><TD CLASS="l">768</TD><TD>            thread = new Thread(new MyRunable(sp,errorHanlder)  );</TD></TR><TR CLASS="z"><TD CLASS="l">769</TD><TD>        thread.start();</TD></TR><TR CLASS="z"><TD CLASS="l">770</TD><TD>    }</TD></TR><TR><TD CLASS="l"><A NAME="19">771</A></TD><TD> </TD></TR><TR><TD CLASS="l">772</TD><TD> </TD></TR><TR><TD CLASS="l">773</TD><TD> </TD></TR><TR><TD CLASS="l">774</TD><TD>    public void setParams(Map&lt;String, String&gt; params) {</TD></TR><TR CLASS="c"><TD CLASS="l">775</TD><TD>        this.params = params;</TD></TR><TR CLASS="c"><TD CLASS="l">776</TD><TD>    }</TD></TR><TR><TD CLASS="l"><A NAME="21">777</A></TD><TD> </TD></TR><TR><TD CLASS="l">778</TD><TD>}</TD></TR><TR><TD CLASS="l">779</TD><TD> </TD></TR><TR><TD CLASS="l">780</TD><TD> </TD></TR><TR CLASS="z"><TD CLASS="l">781</TD><TD>class DeviceInfo {</TD></TR><TR><TD CLASS="l">782</TD><TD> </TD></TR><TR><TD CLASS="l">783</TD><TD>    private static LocationListener listener;</TD></TR><TR><TD CLASS="l">784</TD><TD> </TD></TR><TR><TD CLASS="l"><A NAME="2c">785</A></TD><TD>    private final static String SHA1_ALGORITHM = &#34;SHA-1&#34;;</TD></TR><TR><TD CLASS="l">786</TD><TD>    private final static String CHAR_SET = &#34;iso-8859-1&#34;;</TD></TR><TR><TD CLASS="l">787</TD><TD> </TD></TR><TR><TD CLASS="l">788</TD><TD>    public static String getUDID() {</TD></TR><TR CLASS="p"><TD CLASS="l" TITLE="67% line coverage (4 out of 6 instructions)">789</TD><TD TITLE="67% line coverage (4 out of 6 instructions)">        return OpenUDID_manager.isInitialized() == false ? &#34;REPLACE_UDID&#34; : OpenUDID_manager.getOpenUDID();</TD></TR><TR><TD CLASS="l"><A NAME="32">790</A></TD><TD>    }</TD></TR><TR><TD CLASS="l">791</TD><TD> </TD></TR><TR><TD CLASS="l">792</TD><TD> </TD></TR><TR><TD CLASS="l">793</TD><TD>    public static String getAndroidID(Context context) {</TD></TR><TR CLASS="c"><TD CLASS="l">794</TD><TD>        String androidID = &#34;&#34;;</TD></TR><TR CLASS="c"><TD CLASS="l">795</TD><TD>        if (context != null) {</TD></TR><TR CLASS="c"><TD CLASS="l">796</TD><TD>            androidID = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID);</TD></TR><TR><TD CLASS="l">797</TD><TD>        }</TD></TR><TR CLASS="c"><TD CLASS="l">798</TD><TD>        return androidID;</TD></TR><TR><TD CLASS="l">799</TD><TD>    }</TD></TR><TR><TD CLASS="l"><A NAME="36">800</A></TD><TD> </TD></TR><TR><TD CLASS="l">801</TD><TD> </TD></TR><TR><TD CLASS="l">802</TD><TD> </TD></TR><TR><TD CLASS="l">803</TD><TD>    public static String getOSVersion() {</TD></TR><TR CLASS="c"><TD CLASS="l"><A NAME="33">804</A></TD><TD>        return Build.VERSION.RELEASE;</TD></TR><TR><TD CLASS="l">805</TD><TD>    }</TD></TR><TR><TD CLASS="l">806</TD><TD> </TD></TR><TR><TD CLASS="l">807</TD><TD>    public static String getDevice() {</TD></TR><TR CLASS="c"><TD CLASS="l"><A NAME="38">808</A></TD><TD>        return Build.MODEL;</TD></TR><TR><TD CLASS="l">809</TD><TD>    }</TD></TR><TR><TD CLASS="l">810</TD><TD> </TD></TR><TR><TD CLASS="l">811</TD><TD>    public static String getResolution(Context context) {</TD></TR><TR CLASS="c"><TD CLASS="l">812</TD><TD>        WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);</TD></TR><TR CLASS="c"><TD CLASS="l">813</TD><TD>        DisplayMetrics metrics = new DisplayMetrics();</TD></TR><TR CLASS="c"><TD CLASS="l">814</TD><TD>        wm.getDefaultDisplay().getMetrics(metrics);</TD></TR><TR CLASS="c"><TD CLASS="l">815</TD><TD>        return metrics.widthPixels * metrics.density + &#34;x&#34; + metrics.heightPixels * metrics.density;</TD></TR><TR><TD CLASS="l"><A NAME="25">816</A></TD><TD> </TD></TR><TR><TD CLASS="l">817</TD><TD>    }</TD></TR><TR><TD CLASS="l">818</TD><TD> </TD></TR><TR><TD CLASS="l">819</TD><TD>    public static String getCarrier(Context context) {</TD></TR><TR CLASS="z"><TD CLASS="l">820</TD><TD>        TelephonyManager manager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);</TD></TR><TR CLASS="z"><TD CLASS="l">821</TD><TD>        return manager.getNetworkOperatorName();</TD></TR><TR><TD CLASS="l"><A NAME="34">822</A></TD><TD>    }</TD></TR><TR><TD CLASS="l">823</TD><TD> </TD></TR><TR><TD CLASS="l">824</TD><TD> </TD></TR><TR><TD CLASS="l">825</TD><TD>    public static String getImei(Context context) {</TD></TR><TR CLASS="c"><TD CLASS="l">826</TD><TD>        TelephonyManager manager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);</TD></TR><TR CLASS="c"><TD CLASS="l">827</TD><TD>        return manager.getDeviceId();</TD></TR><TR><TD CLASS="l"><A NAME="27">828</A></TD><TD>    }</TD></TR><TR><TD CLASS="l">829</TD><TD> </TD></TR><TR><TD CLASS="l">830</TD><TD> </TD></TR><TR><TD CLASS="l">831</TD><TD>    public static String getLocale() {</TD></TR><TR CLASS="z"><TD CLASS="l">832</TD><TD>        Locale locale = Locale.getDefault();</TD></TR><TR CLASS="z"><TD CLASS="l"><A NAME="24">833</A></TD><TD>        return locale.getLanguage() + &#34;_&#34; + locale.getCountry();</TD></TR><TR><TD CLASS="l">834</TD><TD>    }</TD></TR><TR><TD CLASS="l">835</TD><TD> </TD></TR><TR><TD CLASS="l">836</TD><TD>    public static String appVersion(Context context) {</TD></TR><TR CLASS="z"><TD CLASS="l">837</TD><TD>        String result = &#34;1.0&#34;;</TD></TR><TR><TD CLASS="l">838</TD><TD>        try {</TD></TR><TR CLASS="z"><TD CLASS="l">839</TD><TD>            result = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName;</TD></TR><TR CLASS="z"><TD CLASS="l">840</TD><TD>        } catch (NameNotFoundException e) {</TD></TR><TR CLASS="z"><TD CLASS="l">841</TD><TD>        }</TD></TR><TR><TD CLASS="l">842</TD><TD> </TD></TR><TR CLASS="z"><TD CLASS="l">843</TD><TD>        return result;</TD></TR><TR><TD CLASS="l"><A NAME="2a">844</A></TD><TD>    }</TD></TR><TR><TD CLASS="l">845</TD><TD> </TD></TR><TR><TD CLASS="l">846</TD><TD>    public static String getLocation(final Context context, boolean requestUpdate) {</TD></TR><TR><TD CLASS="l">847</TD><TD> </TD></TR><TR CLASS="c"><TD CLASS="l">848</TD><TD>        LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);</TD></TR><TR><TD CLASS="l">849</TD><TD> </TD></TR><TR><TD CLASS="l">850</TD><TD>        try {</TD></TR><TR CLASS="c"><TD CLASS="l">851</TD><TD>            Criteria criteria = new Criteria();</TD></TR><TR CLASS="c"><TD CLASS="l">852</TD><TD>            criteria.setAccuracy(Criteria.ACCURACY_COARSE);</TD></TR><TR CLASS="c"><TD CLASS="l">853</TD><TD>            criteria.setAltitudeRequired(false);</TD></TR><TR CLASS="c"><TD CLASS="l">854</TD><TD>            criteria.setBearingRequired(false);</TD></TR><TR CLASS="c"><TD CLASS="l"><A NAME="1b">855</A></TD><TD>            criteria.setCostAllowed(true);</TD></TR><TR CLASS="c"><TD CLASS="l">856</TD><TD>            criteria.setPowerRequirement(Criteria.POWER_LOW);</TD></TR><TR CLASS="c"><TD CLASS="l">857</TD><TD>            String provider = locationManager.getBestProvider(criteria, true);</TD></TR><TR CLASS="c"><TD CLASS="l"><A NAME="1f">858</A></TD><TD>            if(listener == null)</TD></TR><TR CLASS="c"><TD CLASS="l">859</TD><TD>                listener = new LocationListener() {</TD></TR><TR><TD CLASS="l">860</TD><TD> </TD></TR><TR><TD CLASS="l"><A NAME="1e">861</A></TD><TD>                    public void onStatusChanged(String s, int i, Bundle bundle) {</TD></TR><TR CLASS="z"><TD CLASS="l">862</TD><TD>                    }</TD></TR><TR><TD CLASS="l">863</TD><TD> </TD></TR><TR><TD CLASS="l"><A NAME="1d">864</A></TD><TD>                    public void onProviderEnabled(String s) {</TD></TR><TR CLASS="z"><TD CLASS="l">865</TD><TD>                    }</TD></TR><TR><TD CLASS="l">866</TD><TD> </TD></TR><TR><TD CLASS="l"><A NAME="1c">867</A></TD><TD>                    public void onProviderDisabled(String s) {</TD></TR><TR CLASS="z"><TD CLASS="l">868</TD><TD>                    }</TD></TR><TR><TD CLASS="l">869</TD><TD> </TD></TR><TR><TD CLASS="l">870</TD><TD>                    public void onLocationChanged(Location location) {</TD></TR><TR CLASS="z"><TD CLASS="l">871</TD><TD>                        String latestLocation = DeviceInfo.getLocation(context, false);</TD></TR><TR CLASS="z"><TD CLASS="l">872</TD><TD>                        Countly.sharedInstance().updateLocationParams(latestLocation);</TD></TR><TR CLASS="z"><TD CLASS="l">873</TD><TD>                        stopListenLocation(context);</TD></TR><TR CLASS="z"><TD CLASS="l">874</TD><TD>                    }</TD></TR><TR><TD CLASS="l">875</TD><TD>                };</TD></TR><TR><TD CLASS="l">876</TD><TD> </TD></TR><TR CLASS="c"><TD CLASS="l">877</TD><TD>            if (requestUpdate)</TD></TR><TR CLASS="z"><TD CLASS="l">878</TD><TD>                locationManager.requestLocationUpdates(provider, 1000, 0, listener);</TD></TR><TR><TD CLASS="l">879</TD><TD> </TD></TR><TR CLASS="z"><TD CLASS="l">880</TD><TD>            Location location = locationManager.getLastKnownLocation(provider);</TD></TR><TR CLASS="z"><TD CLASS="l">881</TD><TD>            Double lat = location.getLatitude();</TD></TR><TR CLASS="z"><TD CLASS="l">882</TD><TD>            Double lng = location.getLongitude();</TD></TR><TR><TD CLASS="l">883</TD><TD> </TD></TR><TR><TD CLASS="l">884</TD><TD> </TD></TR><TR CLASS="z"><TD CLASS="l">885</TD><TD>            String latStr = new BigDecimal(lat.doubleValue()).toString();</TD></TR><TR CLASS="z"><TD CLASS="l">886</TD><TD>            if (latStr.length() &gt;= 10)</TD></TR><TR CLASS="z"><TD CLASS="l">887</TD><TD>                latStr = latStr.substring(0, 10);</TD></TR><TR><TD CLASS="l">888</TD><TD> </TD></TR><TR CLASS="z"><TD CLASS="l">889</TD><TD>            String lngStr = new BigDecimal(lng.doubleValue()).toString();</TD></TR><TR CLASS="z"><TD CLASS="l">890</TD><TD>            if (lngStr.length() &gt;= 10)</TD></TR><TR CLASS="z"><TD CLASS="l">891</TD><TD>                lngStr = lngStr.substring(0, 10);</TD></TR><TR><TD CLASS="l">892</TD><TD> </TD></TR><TR><TD CLASS="l">893</TD><TD> </TD></TR><TR CLASS="z"><TD CLASS="l">894</TD><TD>            String accuracyStr = new BigDecimal(location.getAccuracy()).toString();</TD></TR><TR CLASS="z"><TD CLASS="l">895</TD><TD>            if (accuracyStr.length() &gt;= 10)</TD></TR><TR CLASS="z"><TD CLASS="l">896</TD><TD>                accuracyStr = accuracyStr.substring(0, 10);</TD></TR><TR><TD CLASS="l">897</TD><TD>//            return latStr + &#34;x&#34; + lngStr;</TD></TR><TR CLASS="z"><TD CLASS="l">898</TD><TD>            if (Countly.LOG) Log.d(Countly.TAG, &#34;##data LBS:&#34;+latStr + &#34;x&#34; + lngStr + &#34;x&#34;+ accuracyStr);</TD></TR><TR CLASS="z"><TD CLASS="l">899</TD><TD>            return latStr + &#34;x&#34; + lngStr + &#34;x&#34;+ accuracyStr;</TD></TR><TR CLASS="c"><TD CLASS="l">900</TD><TD>        } catch (Exception e) {</TD></TR><TR CLASS="c"><TD CLASS="l">901</TD><TD>            System.out.println(&#34;##data Error LBS&#34;);</TD></TR><TR CLASS="c"><TD CLASS="l">902</TD><TD>            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.</TD></TR><TR><TD CLASS="l">903</TD><TD>        }</TD></TR><TR CLASS="c"><TD CLASS="l"><A NAME="29">904</A></TD><TD>        return &#34;&#34;;</TD></TR><TR><TD CLASS="l">905</TD><TD>    }</TD></TR><TR><TD CLASS="l">906</TD><TD> </TD></TR><TR><TD CLASS="l">907</TD><TD>    private static void stopListenLocation(Context context) {</TD></TR><TR CLASS="z"><TD CLASS="l">908</TD><TD>        LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);</TD></TR><TR CLASS="z"><TD CLASS="l">909</TD><TD>        if (listener != null)</TD></TR><TR CLASS="z"><TD CLASS="l">910</TD><TD>            locationManager.removeUpdates(listener);</TD></TR><TR CLASS="z"><TD CLASS="l"><A NAME="26">911</A></TD><TD>    }</TD></TR><TR><TD CLASS="l">912</TD><TD> </TD></TR><TR><TD CLASS="l">913</TD><TD> </TD></TR><TR><TD CLASS="l">914</TD><TD>    public static String getIP(Context context) {</TD></TR><TR CLASS="z"><TD CLASS="l">915</TD><TD>        String ip = null;</TD></TR><TR><TD CLASS="l">916</TD><TD> </TD></TR><TR CLASS="z"><TD CLASS="l">917</TD><TD>        WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);</TD></TR><TR><TD CLASS="l">918</TD><TD> </TD></TR><TR><TD CLASS="l">919</TD><TD>        //Method 3</TD></TR><TR><TD CLASS="l">920</TD><TD>        try {</TD></TR><TR CLASS="z"><TD CLASS="l">921</TD><TD>            Enumeration&lt;NetworkInterface&gt; interfaces = NetworkInterface.getNetworkInterfaces();</TD></TR><TR CLASS="z"><TD CLASS="l">922</TD><TD>            NetworkInterface inf = interfaces.nextElement();</TD></TR><TR CLASS="z"><TD CLASS="l">923</TD><TD>            for (Enumeration&lt;InetAddress&gt; enumAddress = inf.getInetAddresses(); enumAddress.hasMoreElements(); ) {</TD></TR><TR CLASS="z"><TD CLASS="l">924</TD><TD>                InetAddress in = enumAddress.nextElement();</TD></TR><TR CLASS="z"><TD CLASS="l">925</TD><TD>                if (!in.isLinkLocalAddress()) {</TD></TR><TR CLASS="z"><TD CLASS="l">926</TD><TD>                    return in.getHostAddress();</TD></TR><TR><TD CLASS="l">927</TD><TD>                }</TD></TR><TR CLASS="z"><TD CLASS="l">928</TD><TD>            }</TD></TR><TR CLASS="z"><TD CLASS="l">929</TD><TD>        } catch (Exception e) {</TD></TR><TR CLASS="z"><TD CLASS="l">930</TD><TD>            e.printStackTrace();</TD></TR><TR><TD CLASS="l">931</TD><TD>            //throw new RuntimeException();</TD></TR><TR CLASS="z"><TD CLASS="l">932</TD><TD>        }</TD></TR><TR CLASS="z"><TD CLASS="l"><A NAME="28">933</A></TD><TD>        return ip;</TD></TR><TR><TD CLASS="l">934</TD><TD>    }</TD></TR><TR><TD CLASS="l">935</TD><TD> </TD></TR><TR><TD CLASS="l">936</TD><TD>    public static String getModel() {</TD></TR><TR CLASS="z"><TD CLASS="l">937</TD><TD>        String device = Build.DEVICE;</TD></TR><TR CLASS="z"><TD CLASS="l">938</TD><TD>        String id = Build.ID;</TD></TR><TR CLASS="z"><TD CLASS="l">939</TD><TD>        String display = Build.DISPLAY;</TD></TR><TR CLASS="z"><TD CLASS="l">940</TD><TD>        String product = Build.PRODUCT;</TD></TR><TR CLASS="z"><TD CLASS="l">941</TD><TD>        String board = Build.BOARD;</TD></TR><TR CLASS="z"><TD CLASS="l">942</TD><TD>        String brand = Build.BRAND;</TD></TR><TR CLASS="z"><TD CLASS="l">943</TD><TD>        String model = Build.MODEL;</TD></TR><TR CLASS="z"><TD CLASS="l"><A NAME="2f">944</A></TD><TD>        return device + &#34;,&#34; + id + &#34;,&#34; + display + &#34;,&#34; + product + &#34;,&#34; + board + &#34;,&#34; + brand + &#34;,&#34; + model;</TD></TR><TR><TD CLASS="l">945</TD><TD>    }</TD></TR><TR><TD CLASS="l">946</TD><TD> </TD></TR><TR><TD CLASS="l">947</TD><TD>    public static boolean isWifi(Context context) {</TD></TR><TR CLASS="c"><TD CLASS="l">948</TD><TD>        ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);</TD></TR><TR CLASS="p"><TD CLASS="l" TITLE="87% line coverage (13 out of 15 instructions)"><A NAME="30">949</A></TD><TD TITLE="87% line coverage (13 out of 15 instructions)">        return cm.getNetworkInfo(ConnectivityManager.TYPE_WIFI).getState() == NetworkInfo.State.CONNECTED ? true : false;</TD></TR><TR><TD CLASS="l">950</TD><TD>    }</TD></TR><TR><TD CLASS="l">951</TD><TD> </TD></TR><TR><TD CLASS="l">952</TD><TD>    public static boolean isNetworkAvailable(Context context) {</TD></TR><TR CLASS="c"><TD CLASS="l">953</TD><TD>        if (context != null) {</TD></TR><TR CLASS="c"><TD CLASS="l">954</TD><TD>            ConnectivityManager connectivity = (ConnectivityManager) context</TD></TR><TR><TD CLASS="l">955</TD><TD>                    .getSystemService(Context.CONNECTIVITY_SERVICE);</TD></TR><TR CLASS="c"><TD CLASS="l">956</TD><TD>            if (connectivity == null) {</TD></TR><TR CLASS="z"><TD CLASS="l">957</TD><TD>                return false;</TD></TR><TR><TD CLASS="l">958</TD><TD>            } else {</TD></TR><TR CLASS="c"><TD CLASS="l">959</TD><TD>                NetworkInfo[] info = connectivity.getAllNetworkInfo();</TD></TR><TR CLASS="c"><TD CLASS="l">960</TD><TD>                if (info != null) {</TD></TR><TR CLASS="p"><TD CLASS="l" TITLE="75% line coverage (6 out of 8 instructions)">961</TD><TD TITLE="75% line coverage (6 out of 8 instructions)">                    for (int i = 0; i &lt; info.length; i++) {</TD></TR><TR CLASS="c"><TD CLASS="l">962</TD><TD>                        if (info[i].getState() == NetworkInfo.State.CONNECTED) {</TD></TR><TR CLASS="c"><TD CLASS="l">963</TD><TD>                            return true;</TD></TR><TR><TD CLASS="l">964</TD><TD>                        }</TD></TR><TR><TD CLASS="l">965</TD><TD>                    }</TD></TR><TR><TD CLASS="l">966</TD><TD>                }</TD></TR><TR><TD CLASS="l">967</TD><TD>            }</TD></TR><TR CLASS="z"><TD CLASS="l">968</TD><TD>        } else {</TD></TR><TR CLASS="c"><TD CLASS="l">969</TD><TD>            Log.e(&#34;NetworkUtil&#34;, &#34;No context.&#34;);</TD></TR><TR><TD CLASS="l">970</TD><TD>        }</TD></TR><TR CLASS="c"><TD CLASS="l"><A NAME="2e">971</A></TD><TD>        return false;</TD></TR><TR><TD CLASS="l">972</TD><TD>    }</TD></TR><TR><TD CLASS="l">973</TD><TD> </TD></TR><TR><TD CLASS="l">974</TD><TD>    public static String getAppName(Context context) {</TD></TR><TR CLASS="c"><TD CLASS="l">975</TD><TD>        PackageManager manager = context.getPackageManager();</TD></TR><TR CLASS="c"><TD CLASS="l">976</TD><TD>        ApplicationInfo info = null;</TD></TR><TR><TD CLASS="l">977</TD><TD>        try {</TD></TR><TR CLASS="c"><TD CLASS="l">978</TD><TD>            info = manager.getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA);</TD></TR><TR CLASS="c"><TD CLASS="l">979</TD><TD>            String appName = info.loadLabel(manager).toString();</TD></TR><TR CLASS="c"><TD CLASS="l">980</TD><TD>            return appName;</TD></TR><TR CLASS="z"><TD CLASS="l">981</TD><TD>        } catch (NameNotFoundException e) {</TD></TR><TR CLASS="z"><TD CLASS="l">982</TD><TD>            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.</TD></TR><TR><TD CLASS="l">983</TD><TD>        }</TD></TR><TR CLASS="z"><TD CLASS="l"><A NAME="37">984</A></TD><TD>        return &#34;&#34;;</TD></TR><TR><TD CLASS="l">985</TD><TD>    }</TD></TR><TR><TD CLASS="l">986</TD><TD> </TD></TR><TR><TD CLASS="l">987</TD><TD>    public static String getPackageName(Context context) {</TD></TR><TR CLASS="c"><TD CLASS="l"><A NAME="35">988</A></TD><TD>        return context.getPackageName();</TD></TR><TR><TD CLASS="l">989</TD><TD>    }</TD></TR><TR><TD CLASS="l">990</TD><TD> </TD></TR><TR><TD CLASS="l">991</TD><TD>    public static String getMacAddress(Context context) {</TD></TR><TR CLASS="c"><TD CLASS="l">992</TD><TD>        String result = &#34;&#34;;</TD></TR><TR CLASS="c"><TD CLASS="l">993</TD><TD>        WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);</TD></TR><TR CLASS="c"><TD CLASS="l">994</TD><TD>        WifiInfo wifiInfo = wifiManager.getConnectionInfo();</TD></TR><TR CLASS="c"><TD CLASS="l">995</TD><TD>        result = wifiInfo.getMacAddress();</TD></TR><TR><TD CLASS="l">996</TD><TD>//        Log.i(&#34;MAC Address&#34;, &#34;macAdd:&#34; + result);</TD></TR><TR CLASS="c"><TD CLASS="l">997</TD><TD>        return result;</TD></TR><TR><TD CLASS="l">998</TD><TD>    }</TD></TR><TR><TD CLASS="l">999</TD><TD> </TD></TR><TR><TD CLASS="l"><A NAME="2b">1000</A></TD><TD> </TD></TR><TR><TD CLASS="l">1001</TD><TD>    public static String getODIN1(Context context) {</TD></TR><TR><TD CLASS="l">1002</TD><TD>        String androidId;</TD></TR><TR><TD CLASS="l">1003</TD><TD>        try {</TD></TR><TR CLASS="c"><TD CLASS="l">1004</TD><TD>            androidId = Settings.System.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID);</TD></TR><TR CLASS="z"><TD CLASS="l">1005</TD><TD>        } catch (Exception e) {</TD></TR><TR><TD CLASS="l">1006</TD><TD> </TD></TR><TR><TD CLASS="l">1007</TD><TD>            // In Android API levels 1-2, Settings.Secure wasn't implemented.</TD></TR><TR><TD CLASS="l">1008</TD><TD>            // Fall back to deprecated methods.</TD></TR><TR><TD CLASS="l">1009</TD><TD>            try {</TD></TR><TR CLASS="z"><TD CLASS="l">1010</TD><TD>                androidId = Settings.System.getString(context.getContentResolver(), Settings.System.ANDROID_ID);</TD></TR><TR CLASS="z"><TD CLASS="l">1011</TD><TD>            } catch (Exception e1) {</TD></TR><TR CLASS="z"><TD CLASS="l">1012</TD><TD>                Log.i(&#34;ODIN&#34;, &#34;Error generating ODIN-1: &#34;, e1);</TD></TR><TR CLASS="z"><TD CLASS="l">1013</TD><TD>                return null;</TD></TR><TR CLASS="z"><TD CLASS="l">1014</TD><TD>            }</TD></TR><TR CLASS="c"><TD CLASS="l">1015</TD><TD>        }</TD></TR><TR><TD CLASS="l">1016</TD><TD> </TD></TR><TR CLASS="c"><TD CLASS="l"><A NAME="31">1017</A></TD><TD>        return SHA1(androidId);</TD></TR><TR><TD CLASS="l">1018</TD><TD>    }</TD></TR><TR><TD CLASS="l">1019</TD><TD> </TD></TR><TR><TD CLASS="l">1020</TD><TD>    private static String convertToHex(byte[] data) {</TD></TR><TR CLASS="c"><TD CLASS="l">1021</TD><TD>        StringBuffer buf = new StringBuffer();</TD></TR><TR CLASS="c"><TD CLASS="l">1022</TD><TD>        for (int i = 0; i &lt; data.length; i++) {</TD></TR><TR CLASS="c"><TD CLASS="l">1023</TD><TD>            int halfbyte = (data[i] &gt;&gt;&gt; 4) &amp; 0x0F;</TD></TR><TR CLASS="c"><TD CLASS="l">1024</TD><TD>            int two_halfs = 0;</TD></TR><TR><TD CLASS="l">1025</TD><TD>            do {</TD></TR><TR CLASS="c"><TD CLASS="l">1026</TD><TD>                if ((0 &lt;= halfbyte) &amp;&amp; (halfbyte &lt;= 9))</TD></TR><TR CLASS="c"><TD CLASS="l">1027</TD><TD>                    buf.append((char) ('0' + halfbyte));</TD></TR><TR><TD CLASS="l">1028</TD><TD>                else</TD></TR><TR CLASS="c"><TD CLASS="l">1029</TD><TD>                    buf.append((char) ('a' + (halfbyte - 10)));</TD></TR><TR CLASS="c"><TD CLASS="l">1030</TD><TD>                halfbyte = data[i] &amp; 0x0F;</TD></TR><TR CLASS="c"><TD CLASS="l">1031</TD><TD>            } while(two_halfs++ &lt; 1);</TD></TR><TR><TD CLASS="l">1032</TD><TD>        }</TD></TR><TR CLASS="c"><TD CLASS="l">1033</TD><TD>        return buf.toString();</TD></TR><TR><TD CLASS="l">1034</TD><TD>    }</TD></TR><TR><TD CLASS="l"><A NAME="2d">1035</A></TD><TD> </TD></TR><TR><TD CLASS="l">1036</TD><TD>    private static String SHA1(String text) {</TD></TR><TR><TD CLASS="l">1037</TD><TD>        try {</TD></TR><TR><TD CLASS="l">1038</TD><TD>            MessageDigest md;</TD></TR><TR CLASS="c"><TD CLASS="l">1039</TD><TD>            md = MessageDigest.getInstance(SHA1_ALGORITHM);</TD></TR><TR><TD CLASS="l">1040</TD><TD>            byte[] sha1hash;</TD></TR><TR CLASS="c"><TD CLASS="l">1041</TD><TD>            md.update(text.getBytes(CHAR_SET), 0, text.length());</TD></TR><TR CLASS="c"><TD CLASS="l">1042</TD><TD>            sha1hash = md.digest();</TD></TR><TR CLASS="c"><TD CLASS="l">1043</TD><TD>            return convertToHex(sha1hash);</TD></TR><TR CLASS="z"><TD CLASS="l">1044</TD><TD>        } catch (Exception e) {</TD></TR><TR CLASS="z"><TD CLASS="l">1045</TD><TD>            Log.i(&#34;ODIN&#34;, &#34;Error generating generating SHA-1: &#34;, e);</TD></TR><TR CLASS="z"><TD CLASS="l">1046</TD><TD>            return null;</TD></TR><TR><TD CLASS="l">1047</TD><TD>        }</TD></TR><TR><TD CLASS="l">1048</TD><TD>    }</TD></TR><TR><TD CLASS="l">1049</TD><TD> </TD></TR><TR><TD CLASS="l">1050</TD><TD> </TD></TR><TR><TD CLASS="l">1051</TD><TD> </TD></TR><TR><TD CLASS="l">1052</TD><TD> </TD></TR><TR><TD CLASS="l">1053</TD><TD> </TD></TR><TR><TD CLASS="l"><A NAME="39">1054</A></TD><TD> </TD></TR><TR><TD CLASS="l">1055</TD><TD>}</TD></TR><TR><TD CLASS="l">1056</TD><TD> </TD></TR><TR><TD CLASS="l">1057</TD><TD> </TD></TR><TR CLASS="c"><TD CLASS="l">1058</TD><TD>class SendEvent {</TD></TR><TR CLASS="c"><TD CLASS="l">1059</TD><TD>    public String url = null;</TD></TR><TR CLASS="c"><TD CLASS="l">1060</TD><TD>    public String muds = null;</TD></TR><TR CLASS="c"><TD CLASS="l">1061</TD><TD>    public Map&lt;String, String&gt; segmentation = null;</TD></TR><TR CLASS="c"><TD CLASS="l"><A NAME="3b">1062</A></TD><TD>    public long timestamp = 0;</TD></TR><TR><TD CLASS="l">1063</TD><TD>    public String eventName;</TD></TR><TR><TD CLASS="l">1064</TD><TD> </TD></TR><TR><TD CLASS="l">1065</TD><TD>    public long getTimestamp() {</TD></TR><TR CLASS="z"><TD CLASS="l"><A NAME="3c">1066</A></TD><TD>        return timestamp;</TD></TR><TR><TD CLASS="l">1067</TD><TD>    }</TD></TR><TR><TD CLASS="l">1068</TD><TD> </TD></TR><TR><TD CLASS="l">1069</TD><TD>    public String getUrl() {</TD></TR><TR CLASS="z"><TD CLASS="l"><A NAME="3a">1070</A></TD><TD>        return url;</TD></TR><TR><TD CLASS="l">1071</TD><TD>    }</TD></TR><TR><TD CLASS="l">1072</TD><TD> </TD></TR><TR><TD CLASS="l">1073</TD><TD>    public String getEventName() {</TD></TR><TR CLASS="z"><TD CLASS="l">1074</TD><TD>        return eventName;</TD></TR><TR><TD CLASS="l">1075</TD><TD>    }</TD></TR><TR><TD CLASS="l">1076</TD><TD>}</TD></TR><TR><TD CLASS="l"><A NAME="3e">1077</A></TD><TD> </TD></TR><TR><TD CLASS="l">1078</TD><TD>class EventQueue {</TD></TR><TR><TD CLASS="l">1079</TD><TD>    private ArrayList&lt;SendEvent&gt; events_;</TD></TR><TR><TD CLASS="l">1080</TD><TD> </TD></TR><TR CLASS="c"><TD CLASS="l">1081</TD><TD>    public EventQueue() {</TD></TR><TR CLASS="c"><TD CLASS="l"><A NAME="40">1082</A></TD><TD>        events_ = new ArrayList&lt;SendEvent&gt;();</TD></TR><TR CLASS="c"><TD CLASS="l">1083</TD><TD>    }</TD></TR><TR><TD CLASS="l">1084</TD><TD> </TD></TR><TR><TD CLASS="l">1085</TD><TD>    public int size() {</TD></TR><TR CLASS="c"><TD CLASS="l">1086</TD><TD>        synchronized (this) {</TD></TR><TR CLASS="c"><TD CLASS="l">1087</TD><TD>            return events_.size();</TD></TR><TR CLASS="z"><TD CLASS="l"><A NAME="42">1088</A></TD><TD>        }</TD></TR><TR><TD CLASS="l">1089</TD><TD>    }</TD></TR><TR><TD CLASS="l">1090</TD><TD> </TD></TR><TR><TD CLASS="l">1091</TD><TD>    public List events() {</TD></TR><TR CLASS="c"><TD CLASS="l"><A NAME="3f">1092</A></TD><TD>        return events_;</TD></TR><TR><TD CLASS="l">1093</TD><TD>    }</TD></TR><TR><TD CLASS="l">1094</TD><TD> </TD></TR><TR><TD CLASS="l">1095</TD><TD>    public void recordEvent(String url, String evetName, String muds) {</TD></TR><TR CLASS="c"><TD CLASS="l">1096</TD><TD>        synchronized (this) {</TD></TR><TR CLASS="c"><TD CLASS="l">1097</TD><TD>            SendEvent sendEvent = new SendEvent();</TD></TR><TR CLASS="c"><TD CLASS="l">1098</TD><TD>            sendEvent.url = url;</TD></TR><TR CLASS="c"><TD CLASS="l">1099</TD><TD>            sendEvent.muds = muds;</TD></TR><TR CLASS="c"><TD CLASS="l">1100</TD><TD>            if (evetName != null &amp;&amp; !&#34;&#34;.equals(evetName))</TD></TR><TR CLASS="c"><TD CLASS="l">1101</TD><TD>                sendEvent.eventName = evetName;</TD></TR><TR CLASS="c"><TD CLASS="l">1102</TD><TD>            sendEvent.timestamp = System.currentTimeMillis();</TD></TR><TR CLASS="c"><TD CLASS="l">1103</TD><TD>            events_.add(sendEvent);</TD></TR><TR CLASS="c"><TD CLASS="l">1104</TD><TD>            if ((this.size() &gt; Countly.OFFLINECACHE_LENGTH) || Countly.SENDIMMEDIATELY) {</TD></TR><TR CLASS="z"><TD CLASS="l">1105</TD><TD>                for (int i = 0; i &lt; this.events().size(); i++) {</TD></TR><TR CLASS="z"><TD CLASS="l">1106</TD><TD>                    if (Countly.sharedInstance().getQueue_() != null)</TD></TR><TR CLASS="z"><TD CLASS="l">1107</TD><TD>                        Countly.sharedInstance().getQueue_().recordEvents((SendEvent) this.events().get(i));</TD></TR><TR><TD CLASS="l">1108</TD><TD>                }</TD></TR><TR CLASS="z"><TD CLASS="l">1109</TD><TD>                this.events().clear();</TD></TR><TR><TD CLASS="l">1110</TD><TD>            }</TD></TR><TR CLASS="p"><TD CLASS="l" TITLE="38% line coverage (3 out of 8 instructions)">1111</TD><TD TITLE="38% line coverage (3 out of 8 instructions)">        }</TD></TR><TR CLASS="c"><TD CLASS="l">1112</TD><TD>    }</TD></TR><TR><TD CLASS="l">1113</TD><TD> </TD></TR><TR><TD CLASS="l">1114</TD><TD> </TD></TR><TR><TD CLASS="l">1115</TD><TD>}</TD></TR></TABLE><P></P><TABLE CLASS="hdft" CELLSPACING="0" WIDTH="100%"><TR><TD CLASS="nv">[<A HREF="../coverage.html">all classes</A>][<A HREF="4.html">cn.com.mma.mobile.tracking.api</A>]</TD></TR><TR><TD CLASS="tl"><A HREF="http://sourceforge.net/projects/emma">EMMA 2.0.5312</A> (C) Vladimir Roubtsov</TD></TR></TABLE></BODY></HTML>